BrandonK Posted January 30, 2008 Share Posted January 30, 2008 I am having an issue with a local intranet script that has been running problem free for many months now. Earlier this week I upgraded the PHP version on the sever as a requirement for a separate script that was upgraded on the server. When I did this, I did not change the php.ini configuration, or ANY code on this script. Now when I run this script it hangs. I have narrowed down the script to a single line of code, and a even a single function: file_get_contents() The return from the function is quick. I can see the return echo'ed out and the script continues processing after that. What does not happen is the page becoming "ready". The page is in a "loading" stage for 3+ seconds longer than it needs to be. My thought is that the problem lies in closing the connection with the file, but I cannot verify that. I have tried using the fopen()/fread()/fclose(), stream_get_contents() and even some quick and dirty curl, but those all suffer from the same lag. Here are come quick before and after benchmarks: PHP 5.1.2 - 0.652, 0.813, 0.703 PHP 5.2.4 - 5.672, 5.547, 5.563 I am able to downgrade the PHP installation and the performance issues goes away. I have tried upgrading to to 5.2.5 and even using the recommended php.ini for that setup, but the problem does not go away. I have asked this question on another forum, but I was unable to get any solutions: http://www.sitepoint.com/forums/showthread.php?t=528407 Can any of the PHP gurus think of a cause of this problem? Or maybe even a temporary work around? Quote Link to comment https://forums.phpfreaks.com/topic/88607-upgraded-php-and-file_get_contents-hangs/ Share on other sites More sharing options...
BrandonK Posted January 31, 2008 Author Share Posted January 31, 2008 My one and only bump. I would really like to find a work around for this. Currently, we are using a temporary work around that requests and saves an entire batch of orders at once. The old script did it per order, as needed, which allowed for error handling. Quote Link to comment https://forums.phpfreaks.com/topic/88607-upgraded-php-and-file_get_contents-hangs/#findComment-454526 Share on other sites More sharing options...
The Little Guy Posted January 31, 2008 Share Posted January 31, 2008 Please Post Your Code Quote Link to comment https://forums.phpfreaks.com/topic/88607-upgraded-php-and-file_get_contents-hangs/#findComment-454530 Share on other sites More sharing options...
BrandonK Posted January 31, 2008 Author Share Posted January 31, 2008 Very simple: $promo_content = file_get_contents("http://www.MYDOMAIN.com/scripts/check_order_promo.php?order=".$ordernum); if ($promo_content == 1) { //this order wants a promotional item } MYDOMAIN.com is not the only domain that is experiencing the lag. Also, as stated above, the lag is not in the response, but actually when the page finishes rendering. Quote Link to comment https://forums.phpfreaks.com/topic/88607-upgraded-php-and-file_get_contents-hangs/#findComment-454633 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.