Jump to content

Recommended Posts

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 [i]"[error] [client 127.0.0.1] PHP Fatal error:  Maximum execution time of 60 seconds exceeded in...[/i]".  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?
Link to comment
https://forums.phpfreaks.com/topic/13516-maximum-execution-time-error/
Share on other sites

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:
[i]max_execution_time = 60[/i]
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:
[code=php:0]<?php
phpinfo();
?>[/code]

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:
[b]max_execution_time[/b]. 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:
[b]Configuration File (php.ini) Path[/b]. 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:
[b]PHPIniDir C:\WINDOWS[/b]
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.
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?
This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.