php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #44056 Get file content
Submitted: 2008-02-05 22:45 UTC Modified: 2008-03-21 01:00 UTC
Votes:1
Avg. Score:3.0 ± 0.0
Reproduced:0 of 0 (0.0%)
From: raphpell at cario dot fr Assigned:
Status: No Feedback Package: Performance problem
PHP Version: 5.2.5 OS: Windows Vista
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: raphpell at cario dot fr
New email:
PHP Version: OS:

 

 [2008-02-05 22:45 UTC] raphpell at cario dot fr
Description:
------------
I handle my filesy stem :
- 2000 files
- 2000 folders

With PHP 4.3.3 my scripts take 5 secondes
With PHP 5.2.5 35 secondes...
I use fopen, file_get_contents ( ob_start + include )

I zip my site, create my db with my filesystem,...


Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2008-02-06 08:13 UTC] derick@php.net
Thank you for this bug report. To properly diagnose the problem, we
need a short but complete example script to be able to reproduce
this bug ourselves. 

A proper reproducing script starts with <?php and ends with ?>,
is max. 10-20 lines long and does not require any external 
resources such as databases, etc. If the script requires a 
database to demonstrate the issue, please make sure it creates 
all necessary tables, stored procedures etc.

Please avoid embedding huge scripts into the report.
 [2008-02-06 18:13 UTC] raphpell at cario dot fr
$_ENV [ 'nFiles' ] = 0 ;
$_ENV [ 'nFolders' ] = 0 ;
$sPath = $prefixe . './' ; // define a file system

function _getmicrotime ( ) {
	list ( $usec, $sec ) = explode ( " " , microtime ( )) ;
	return ( ( (float) $usec + (float) $sec ) * 1000 ) ;
	};
	
function doSomething ( $sPath ) {
	$_ENV [ "nFolders" ]++ ;
	$a = glob ( $sPath . "*" ) ;
	if ( $a ) 
		while ( list (, $sFile ) = each ( $a )){
			if ( is_dir ( $sFile ) AND ! in_array ( $sFile , Array ( "." , ".." )))
				doSomething ( $sFile . "/" ) ;
			if ( is_file ( $sFile )){
				$s = file_get_contents ( $sFile ) ;
				$_ENV [ "nFiles" ]++ ;
				}
			}
	};
	
$nStart = _getmicrotime ( ) ;
if ( is_dir ( $sPath )) doSomething ( $sPath ) ; else die ( $sPath ) ;
echo 
	' - time: '. (int)( _getmicrotime ( ) - $nStart ) . 'ms ' .
	' - Files: '. $_ENV [ "nFiles" ] .
	' - Folders: '. $_ENV [ "nFolders" ] ;

/*
EXECUTION TIME

[PHP 4.3.10]
2848.597 ms
2915.554 ms
2798.933 ms

[PHP 5.2.5]
11469.610 ms
11199.461 ms
11227.722 ms
*/
 [2008-03-21 01:00 UTC] php-bugs at lists dot php dot net
No feedback was provided for this bug for over a week, so it is
being suspended automatically. If you are able to provide the
information that was originally requested, please do so and change
the status of the bug back to "Open".
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Mon Jun 02 22:01:27 2025 UTC