Jump to content


Photo

Maximum execution time error


  • Please log in to reply
3 replies to this topic

#1 rvaneperen

rvaneperen
  • New Members
  • Pip
  • Newbie
  • 2 posts

Posted 03 July 2006 - 05:20 AM

I am fairly new to PHP, and I'm working on a page that is doing a large number of inserts into a mySQL database.  It works fine for the most part, but sometimes I get the following "[error] [client 127.0.0.1] PHP Fatal error:  Maximum execution time of 60 seconds exceeded in...".  I have my php.ini set to the following: max_execution_time = 120, but this doesn't work (assuming restarting apache is all it takes to get this setting to take effect).  Is this the right setting to change, or is this controlled somewhere else?


#2 wildteen88

wildteen88
  • Staff Alumni
  • Advanced Member
  • 10,482 posts
  • LocationUK, Bournemouth

Posted 03 July 2006 - 03:05 PM

Basically your PHP script has run longer than the max execution time set in the PHP.ini
You need to find the following line in the php.ini:
max_execution_time = 60
And chnage 60 to the time in secounds for how long you want your scripts to timeout at. Save your php.ini and restart your server.

Now to test this chnage has taken affect. Run the following script:
<?php
phpinfo();
?>

When you run that code you should get a page full of information about PHP and the server. Now scroll down a find the line that starts with this:
max_execution_time. Both coloumns to the right should state what you set in the php.ini, for exmaple 120

If they dont scroll back up to the top and verify that PHP is using the correct php.ini by looking for line that starts of with this:
Configuration File (php.ini) Path. To the right of that it should state the full path to your php.ini file. Is the php.ini file in the location it is showing. If it is not in the location stated then PHP is currently not using the php.ini file.

You can fix this by finding you php.ini file and moving it to the WINDOWS folder or if you have Apache2 installed you can add the following line to the httpd.conf file:
PHPIniDir C:\WINDOWS
Change C:\WINDOWS to the correct path. For example if your php.ini file is in your PHP folder then use this: C:\php, presumming your PHP folder is in the root of the C drive.

Once you have moved or added the PHPiniDir line to Apaches config file save any files you have changes and restart Apache. Run the phpinfo script again and check whether PHP is using the correct php.ini fileand that the max_execution_time setting has been updated.


#3 rvaneperen

rvaneperen
  • New Members
  • Pip
  • Newbie
  • 2 posts

Posted 03 July 2006 - 03:53 PM

Thanks for the reply.  As stated in my post, I did have max_execution_time set to 120 in php.ini.  Running phpinfo confirmed it and the fact that it was looking at the correct instance of php.ini.  However, as I have continued looking at this, I found some other related posts that seem to suggest that running Apache2.2 might be the culprit.  For instance, I got errors when I tried to add the PHPIniDir entry to httpd.  Is this just a matter of downgrading to Apache2.0 perhaps?

#4 wildteen88

wildteen88
  • Staff Alumni
  • Advanced Member
  • 10,482 posts
  • LocationUK, Bournemouth

Posted 03 July 2006 - 03:56 PM

If you are usiong Apache2.2 you should downgrade to Apache2.0.x. PHP doesnt offically support Apache2.2.x

Also about the PHPIniDir line. I forgot to add quotes around the Path.




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users