I am continuously facing a problem with some of my pages not loading. Basically, my pages have a total of 7 included scripts, the page will stop loading after calling the first 4 includes on the page, then not loading the content of the actual page. I am seeing this problem during peak and off-peak hours, system requirements are not a factor. Is this a common error seen in pages such as mine with multiple includes? I have tested include('.file_name.html') and include_once('.file_name.html'), both return the same results. Also, some pages pull from MySQL others have the content loaded in the script. Any help will be greatly appreciated.
I'd go through the main script and comment out each include and add them in one by one to see where the bottleneck lies. I suspect that one of them may be pinging a thirdparty site to verify license information, send system info (could be legit, could be very, very bad) and that site is down or not responding and therefore you page is held up. Once you've identified it you then have to * identify the cause of the problem * fix it * decide if you can live with(out) the script * find an alternate script to do the job hope this helps
The direct answer to your question is no, it is not common to encounter errors with multiple includes. The correct syntax is include("file.html"); you would use the . if you were attempting to go up a directory level include("../file.html"); or include("../../file.html"); to go up two directory levels Note that PHP works from the directory of the script called in the URL, NOT the directory of the script including the file. This may or may not be an issue for you. If this is an issue, there are various workarounds. Two of less complicated ways would be to use the absolute path to the included file or using the reserved document root variable include ($_SERVER['DOCUMENT_ROOT'] . "/path/file.html"); If there is no php in the file being included, there is a faster way to include a file than using include() echo file_get_contents("file.html");
i wasn't actually quoting "('.filename.php')" as the extension, i tend to use './' or '../'. as for SARAHK's remarks. this could definitely be true, i had adbrite and now adsense ad's, and we all know how slow they can load. i have taken the ads out, and haven't had the page blank on me in about 700 page loads, which, normally wouldn't happen. just out of curiousity, if the ads were the problem, iframes would in theory allow the ad's to load under their own, without slowing the actual page/scripts down? or am I wrong with that thought? many thanks guys
adsense ads are javascript so they won't have been causing the problem - you'd just be left with a hole. Unless ofcourse you are using phpadsnew or something to serve the ads but I'm guessing you aren't. iframes can be a good of isolating problem code but be aware of browser differences and seo disadvantages (not an issue with ads).
i really cant tell, the only thing that i am calling from an outside source, is adsense ads. I do however run them in a basic array-style ad-rotator with my own RON ad's, with a database recording user variables for statistics. but, i went to an iframe using $_SERVER['HTTP_REFERER'], and i haven't had a problem now for close to 1500 pageviews. cross my fingers that, this was the problematic script and it is resolved. thanks a ton sarahk for your help.