Question

How can I find out where max_execution_time is being set to 60?

Hello.

Running php7, apache2 on ubuntu 16.04

I am having some issues regarding XML parsing in Wordpress.

My max_execution_time needs to be changed to 180 serverwide, but I cannot seem to change it. I have tried altering php.ini in /etc/php/7.0/apache2/, which my phpinfo() says is the relevant file. I have restarted my Apache2 server, but it doesn’t seem to change anything. max_execution_time stays at 60.

phpinfo() says that there are also other ini files being loaded, and my guess is that one of these files may handle the max_execution_time setting. I cannot figure out if this is the case, or if so - how to find and change the setting. Can anyone help me out?


Submit an answer

This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

Sign In or Sign Up to Answer

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Hello there,

You can create a php info file in order to check the current values and check which is the php.ini file in use. Create the following file in your public_hmtl folder - phpinfo.php and put the following code inside it:

<?php
phpinfo();
?>

You can also use the following command in order to find the location of the php.ini file:

php -i | grep php.ini

The output will be:

Configuration File (php.ini) Path => /etc/php/7.2/cli
Loaded Configuration File => /etc/php/7.2/cli/php.ini

Then check for the current value of max_execution_time you can also check which is the configuration file - php.ini that is currently used and apply the changes there (if the site using the global php.ini file and you change the values for these settings this will make the changes globally for all sites).

You also need to restart your web server in order for the changes to take effect. Additionally, a restart of the php-fpm restart is also needed.

Hope that this helps! Regards, Alex

In general, /etc/php/7.0/apache2/php.ini is the file where max_execution_time is configured. After making an update there, you will need to restart Apache with: sudo service apache2 restart

In your case, it sounds like this value is being over-rode in a different file (possibly located in /etc/php/7.0/apache2/conf.d/). The first thing I would try to locate where this is occurring is search the files in /etc with grep For example:

  1. grep -r 'max_execution_time' /etc/

One thing that is important to note is that the command line php command uses a separate configuration file from the one used by Apache. This is generally located at /etc/php/7.0/cli/php.ini but you can find it on your system by running:

  1. php -i |grep "php.ini"