Re: Include statement fails about 1% of the time

From: Date: Fri, 02 May 2003 18:05:45 +0000
Subject: Re: Include statement fails about 1% of the time
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-146166@lists.php.net to get a copy of this message
Include statements do have a cost but I wouldn't say they are very inefficient and I wouldn't go to great lengths to avoid them. In most cases the benefits of using includes properly far outweigh the cost involved in using them (imagine writing the Linux Kernel or the Windows OS using only one source file). Includes allow you to logically organize your application and use a more modular system, just don't put each individual function in it's own file. The access method of the script should not influence whether or not the include works, I would check and see if your system is exceeding the maximum number of open files or if it is hitting an open file limit set somewhere, when this happens the system can't open any more files. An open file limit problem can be tricky to find because it only happens when x files are open which on a web server would be under load. The fact that the include works 99% of the time leads me to believe it is probably a problem somewhere other than the include functionality itself. Also what version of PHP are you running with what web server, what OS is it running on? I would recommend logging the number of open files and load of the server when this problem occurs. Jason Derrick Fogle wrote:
I've already been told that using include() statements is very inefficient and should be avoided. But... I've written a web app that uses them, and a little more than 1% of the time, the execution of the file that calls an include just halts right before or after the include. No errors, no nothing. Are include() statements really *that* bad? Or might there be something else in my system (Linux RedHat 7 right now) that could be causing this? I've only ever confirmed it happening when Win/MSIE connects via SSL, and have never been able to reproduce the problem from the user's perspective in-house; I've beefed up the SSL definition in my httpd.conf file to minimize problems with MSIE, but I've put a debug tracking mechanism in my code and have caught it not finishing code execution on about 1% of the page accesses. -Derrick


« previous php.general (#146166) next »