I am testing a page generated by a script that performs some operations and redirects to another script. It times out at ~ 60 seconds although the max_execution_time is set to 300.

Other revelant settings could be:

mysql.connect_timeout   60
default_socket_timeout  60

Would these be causing this behavior?

  • If its the page that shows a timeout, perhaps "504 Gateway Time-out", then the PHP script might still be running. See other settings in Apache (not PHP related). – ToolmakerSteve Apr 4 '19 at 20:26

In PHP did you use the function

| improve this answer | |
  • 1
    FYI - this command is analogous to setting max_execution_time in php.ini, which the OP has already done. – EEAA Sep 25 '10 at 14:52
  • max_execution_time is a php.ini directive as you said, but I suggest to try the set_time_limit() at the top of the PHP script to ensure there is no configuration issue. – e2-e4 Sep 25 '10 at 15:01
  • 3
    Sure, well a check of phpinfo() would verify whether or not max_execution_time is being set correctly by the php.ini. – EEAA Sep 25 '10 at 15:06

It's also possible that your PHP configuration could be overriding it. For example, I once had set php_value max_execution_time 600 in my Apache VirtualHost configuration on the <Directory> of my Drupal 5 install, but a file in Drupal 5 core has a line that containss max_execution_time 240. Because the Drupal code was processed later, it overrode the Apache configuration option.

The solution for me to "force" my declaration was to set it in Apache as php_admin_value max_execution_time 600. The php_admin_value means that PHP scripts cannot change the value you set it to.

| improve this answer | |

Is it possibly hitting the memory_limit set in php.ini? Run top while the script is running and see if its memory consumption increases to near the set limit before timing out.

I would highly doubt that the current settings for mysql.connect_timeout and default_socket_timeout would be causing any problems.

Also, just to make sure, you did restart apache after making the php.ini changes, correct?

| improve this answer | |

This could have been re-configured in a .htaccess file somewhere within the site (or superior folders).

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.