soma56 Posted March 27, 2012 Share Posted March 27, 2012 This is mind bender. I recently upgraded from a VPS to a Dedicated server. The script is a data mining tool that primarily uses cURL. It worked flawlessy on the the VPS. Because it was the same hosting company everything was migrated and done so smoothly to the new dedicated. Now, the program hangs for no reason at all. The times vary but I'll usually get about an hour of the script before it hangs. It used to run for hours at a time on the VPS. While I do see some 'notices' and cURL timeouts - there are no error messages echoed out when the program hangs and there is nothing within the error log on the server to indicate anything in terms of why. The program simply 'freezes'. I think I've spent the last three days modifying the php.ini file. Here are some settings which may be of interest? post_max_size = 16M log_errors = On max_execution_time = 0; (From what I understand is unlimited). max_input_time = 0 ; memory_limit = 128M; At the top of every page within my script: set_time_limit(0); error_reporting(E_ALL); The dedicated is an 8 gig Linux box running Apache. Speaking of which, here are some settings within WHM for Apache: Max Clients 500 Max Requests Per Child - 0 (unlimited) Keep-Alive - On Keep-Alive Timeout - 50 Max Keep-Alive Requests - Unlimited Timeout - 1000 Because the script works on another VPS that I have within the same hosting company can someone direct me with what I should be looking for and/or comparing between both servers? What are the most common reasons for a PHP script to freeze from a server setting standpoint? Quote Link to comment https://forums.phpfreaks.com/topic/259828-script-works-on-vps-but-not-on-dedicated-server/ Share on other sites More sharing options...
lovelycesar Posted March 28, 2012 Share Posted March 28, 2012 Hello, If you find out nothing on your site's error log file, so it's a strange for 'freezeness' of your application. I have met once as yours. Let you try increase the memory_limit from '128M' into '256M' or '512M'. Don't miss restart the Apache! Quote Link to comment https://forums.phpfreaks.com/topic/259828-script-works-on-vps-but-not-on-dedicated-server/#findComment-1331788 Share on other sites More sharing options...
soma56 Posted March 28, 2012 Author Share Posted March 28, 2012 max_execution_time = 0 max_input_time = 0 memory_limit = 512M output_buffering = 1024 implicit_flush = On Nothing. Still freezing. I thought upgrading to an additional 6 gigs of ram on a dedicated would be a good thing. The mystery is that there is no errors reported back. VPS > Script executes and runs flawlessly Dedicated > Freezes for no reason at all after about an hour My next steps: I'm reviewing the differences between the htaccess file, php.ini file and Apache settings within WHM to see if I can match the VPS to the dedicated. Hostings next steps: They're reverting the PHP version from 5.2.9 to 5.2.17 on the dedicated server to match the same version on the VPS. This is a total mind f#$... Suggestions and sympathies welcome... Quote Link to comment https://forums.phpfreaks.com/topic/259828-script-works-on-vps-but-not-on-dedicated-server/#findComment-1332013 Share on other sites More sharing options...
kicken Posted March 29, 2012 Share Posted March 29, 2012 How are you running this script? If this is a crawler/scraper that you intend to run for hours then you should be running it as a cli script, and not through apache. As such your apache settings are not a factor and you may need to be editing a different php.ini. Run php -i | grep php\.ini at a command line to find the location of the right file for cli. If you are running it via cli, when it freezes use a tool like top to see what is going on. Check how much memory and cpu it is using, see what state it is in. You should probably get your PHP updated to 5.3.x, it's been the latest for quite a while now. Quote Link to comment https://forums.phpfreaks.com/topic/259828-script-works-on-vps-but-not-on-dedicated-server/#findComment-1332186 Share on other sites More sharing options...
lovelycesar Posted March 29, 2012 Share Posted March 29, 2012 Could you show your site's Apache config file ? I suppose you have a low level of warnings in your site_error.log ?! Quote Link to comment https://forums.phpfreaks.com/topic/259828-script-works-on-vps-but-not-on-dedicated-server/#findComment-1332430 Share on other sites More sharing options...
soma56 Posted March 29, 2012 Author Share Posted March 29, 2012 How are you running this script? If this is a crawler/scraper that you intend to run for hours then you should be running it as a cli script, and not through apache. Perhaps, however, it runs flawlessly on the same hosting companies VPS and I don't know the first thing about cli. Could you show your site's Apache config file ? I suppose you have a low level of warnings in your site_error.log ?! Is this what you mean?... Server Limit 1000 Max Clients 500 Max Requests Per Child - 0 (unlimited) Keep-Alive - On Keep-Alive Timeout - 50 Max Keep-Alive Requests - Unlimited Timeout - 1000 You should probably get your PHP updated to 5.3.x, it's been the latest for quite a while now. I'm spent and I'm tired of my heart palpitating and cramping because of this. It's been a week and I think I've changed just about every php.ini, hta and apache setting there is. I'm going to ask the hosting company to upgrade to the latest version of PHP to see if that solves the issue but something tells me I'm just wasting my time. Quote Link to comment https://forums.phpfreaks.com/topic/259828-script-works-on-vps-but-not-on-dedicated-server/#findComment-1332454 Share on other sites More sharing options...
kicken Posted March 29, 2012 Share Posted March 29, 2012 Perhaps, however, it runs flawlessly on the same hosting companies VPS and I don't know the first thing about cli. Just because it might work under a specific configuration doesn't make it a good idea. I wrote an IRC bot once, and sure it would work being run through apache, but it ties up apache worker processes and has a lot of additional unnecessary overhead. The right way to run a long-running script is via CLI. I'm assuming that you have SSH access. Login via ssh and run the command: php -i To verify that you have a cli version of PHP installed. If not, ask your host to install it (or do it yourself). Once verified, cd into the directory containing your crawler script and run the commands: nohup php theCrawler.php >crawler.log 2>&1 & disown to start the process. You can then logout of ssh and your script should be running. Wait and see if you have the same problem or if it goes away. You will be able to see the output (if any) of the process in a new file called crawler.log. You can monitor this file if desired by running: tail -f crawler.log Quote Link to comment https://forums.phpfreaks.com/topic/259828-script-works-on-vps-but-not-on-dedicated-server/#findComment-1332511 Share on other sites More sharing options...
lovelycesar Posted March 30, 2012 Share Posted March 30, 2012 Could you show your site's Apache config file ? I suppose you have a low level of warnings in your site_error.log ?! Is this what you mean?... No, I meant your virtual host's config file, e.g. <VirtualHost ...> .... </VirtualHost> Quote Link to comment https://forums.phpfreaks.com/topic/259828-script-works-on-vps-but-not-on-dedicated-server/#findComment-1332582 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.