Maximum number of open files
Moderator: General Moderators
Maximum number of open files
I believe in windows php is only allowed to have 256 files open at one time. I tried to have a script that would use 4096 files. so I had it open each file and write what was needed then close it then open the next one. Problem when it was done the page did not finish. And after telling apache to restart it couldn't had to restart the whole system to get everything back up. Was not sure if maybe I am doing it right or not.
- John Cartwright
- Site Admin
- Posts: 11470
- Joined: Tue Dec 23, 2003 2:10 am
- Location: Toronto
- Contact:
That makes a lot more sense than loading 4096 files into memory..Extremest wrote:well what it I need to do is put different things in each file depending on the first 3 letters. There is 4096 total. I was just going to have it open the one that it needs at write time then close after the write and move on to the next one.
Re: Maximum number of open files
And that is what he originally said:
but it didn't work outExtremest wrote:I had it open each file and write what was needed then close it then open the next one.
So why didn't it work? Is the problem Windows, PHP, Apache or his code? Is there a work around?Problem when it was done the page did not finish. And after telling apache to restart it couldn't had to restart the whole system to get everything back up. Was not sure if maybe I am doing it right or not.
Re: Maximum number of open files
Yes, use a database.sheila wrote: Is there a work around?
Do you have a memory limit or max execution time set in your php.ini?
Try calling ob_implicit_flush() and outputting a success message every file, so you can track down exactly which file it is failing on.
Also is there something here that you're not mentioning, are any of the files ridiculously large / using strange character encoding for the filenames etc?
My guess for PHP to cause Apache to lock up like that you ran out of memory, can we take a look at your code just to ensure there is no infinite ninja-loops and that sort of thing? (no intention of offending you by questioning your ability to spot errors this blatant, but by looking at your code someone might see something that sticks out)
Try calling ob_implicit_flush() and outputting a success message every file, so you can track down exactly which file it is failing on.
Also is there something here that you're not mentioning, are any of the files ridiculously large / using strange character encoding for the filenames etc?
My guess for PHP to cause Apache to lock up like that you ran out of memory, can we take a look at your code just to ensure there is no infinite ninja-loops and that sort of thing? (no intention of offending you by questioning your ability to spot errors this blatant, but by looking at your code someone might see something that sticks out)