Re: Directory Listing and File Reading errors

From: Date: Wed, 05 Sep 2001 07:11:29 +0000
Subject: Re: Directory Listing and File Reading errors
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-66000@lists.php.net to get a copy of this message
> I'm recursivley reading and editing every .htm and .html file in a 500 page > website and upgrading it to contain linked CSS, Javascript includes and PHP > includes. i can't use a pre_pend file as there's more than one website on > the server, and the changes are embedded in the document rather than just > the header/footer. the script works fine and all, trouble is that PHP > doesn't. > > Sometimes the script will run fine, other times PHP will decide to read the > same file 10-20 times and then do the same for everyfile in certain > directories. it's really annoying as some changes will be made over and over > and over, also with 500 files being read 5-10 times each, the page times out > after about 5000 reads... > > is this a PHP bug? or an Microsoft bug? or something else... > > i'm running PHP verson 4.0.4pl1 off a 2000 server and IIS First, are you 100% sure you are correctly recursing through directories? Show us the source. Second: It *may* be possible that modifying the files in the midst of opendir/readdir is shuffling enough things around on the hard drive that you are confusing the OS. (It is Windows, after all) What you might try would be to use opendir/readdir to create a monster array of every path you want to alter. Then, walk through that array and do the alterations. You can even dump out the array first and check it by hand to be sure it's want you think it should be, and then turn on the code in a second run to do the alteration. If all else fails -- If you're able to add this stuff into the file, you can probably detect if it's already been added, and skip a file you already edited... -- WARNING richard@zend.com address is an endangered species -- Use ceo@l-i-e.com Wanna help me out? Like Music? Buy a CD: http://l-i-e.com/artists.htm Volunteer a little time: http://chatmusic.com/volunteer.htm

« previous php.general (#66000) next »