Question

How to change max_execution time in php 30 to 100

hello,

on my basic server php max_execution limit change 30 to 100 currently set 30 default so we want to change 100 but this php.ini file not accessible and read-only massage display. kindly guid us how to change this value.


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.

Bobby Iliev
Site Moderator
Site Moderator badge
April 28, 2023

Hi there,

You can change your PHP values via the php.ini file. The exact location of the php.ini file depends on your setup, but you can follow the steps here on how to locate the correct php.ini file and make the necessary change:

  1. Create a new file named info.php in your web server’s document root (usually /var/www/html if you are using the default, but might be different if you’ve created a custom virtual host).

  2. Add the following content to the info.php file:

<?php

phpinfo();

?>
  1. Save the file and close it.

  2. Open your web browser and navigate to http://your_server_domain_or_IP/info.php. This will display the PHP information page.

  3. Look for the “Loaded Configuration File” row. This row shows the path to the php.ini file currently in use.

  4. Now that you’ve found the location of your php.ini file, open it using a text editor. For example, if you’re using the command line, you can use nano or vim:

sudo nano /path/to/your/php.ini

Replace /path/to/your/php.ini with the actual path you found in step 5.

  1. Find the max_execution_time directive in the file. You can search for it by pressing Ctrl + W in nano or / in vim and typing max_execution_time. Update the value to 100:
max_execution_time = 100
  1. Save the file and exit the editor (Ctrl + X and then Y to save and exit in nano, or :wq in vim).

  2. If you are using PHP-FPM with Nginx, restart the PHP-FPM service to apply the changes:

sudo systemctl restart php8.1-fpm

Replace 8.1 with your PHP version.

If you are using Apache, then you need to restart the Apache web server:

sudo systemctl restart apache2
  1. Finally, you can delete the info.php file from your document root that you created in step 2, as it’s not recommended to keep this file publicly accessible for security reasons:
sudo rm /path/to/your/document_root/info.php

Now the max_execution_time value has been updated to 100.

Let me know if you have any questions.

Best,

Bobby

Try DigitalOcean for free

Click below to sign up and get $200 of credit to try our products over 60 days!

Sign up

Get our biweekly newsletter

Sign up for Infrastructure as a Newsletter.

Hollie's Hub for Good

Working on improving health and education, reducing inequality, and spurring economic growth? We'd like to help.

Become a contributor

Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.

Welcome to the developer cloud

DigitalOcean makes it simple to launch in the cloud and scale up as you grow — whether you're running one virtual machine or ten thousand.

Learn more
DigitalOcean Cloud Control Panel