habibzain Just husband, father and enthusiastic men about System Administration. Love to write short article about it. Perhaps can help and be useful for others.

Increase php Request Timeout

1 min read

If we have apps build with php, PHP has its own configuration settings for request timeout. You can Increase php Request Timeout scripts by adjusting the max_execution_time setting in your PHP configuration. This setting specifies the maximum amount of time (in seconds) a PHP script can run before being terminated.

Here’s how to increase the request timeout for PHP:

Locate your php.ini file:

The php.ini file contains the configuration settings for PHP. The location of this file can vary depending on your server’s setup and operating system. You can usually find it in one of the following locations:
We can easy found php.ini with this command.

php -i | grep 'php.ini'

Example output:

$ php -i | grep 'php.ini'

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

Commonly, php.ini located here:

  1. On Linux: /etc/php/php.ini (for system-wide settings) or /path/to/your/php.ini (for user-specific settings).
  2. On Windows: C:\php\php.ini or C:\xampp\php\php.ini (if you are using XAMPP).

Open the php.ini file in a text editor with administrative privileges.

Open the php.ini and find and adjust the max_execution_time setting.

Search for the max_execution_time directive in the php.ini file. By default, it’s usually set to 30 seconds. Change it to the desired timeout value in seconds. For example, to set a timeout of 180 seconds (3 minutes), you can modify the line as follows:

max_execution_time = 180
Increase php Request Timeout

Save the php.ini file and Restart web server.

After modifying the php.ini file, you’ll need to restart your web server to apply the changes. The method to restart the web server depends on the server software you are using. For example:

  • On Apache, you can usually use a command like sudo service apache2 restart (on Linux) or httpd -k restart (on Windows).
  • On Nginx, use sudo service nginx restart (on Linux) or nginx -s reload (on Windows).

After making these changes, PHP scripts executed on your web server will have an increased timeout. However, be cautious when increasing the execution time, as it may have performance and security implications. Make sure that your server can handle longer-running scripts and that you are aware of the potential security risks associated with longer execution times for PHP scripts.

This is easy way to increase php request timeout. Please feel free for comment out. Maybe usefull.


habibzain Just husband, father and enthusiastic men about System Administration. Love to write short article about it. Perhaps can help and be useful for others.

Easy Create Laravel Project with Composer

Requirement Laravel, a popular PHP framework, is renowned for its elegant syntax and robust features, making it a top choice for web developers. One...
habibzain
1 min read

Virtualbox Change Storage Size

Changing the storage size of a virtual machine in VirtualBox involves a few steps. Here’s a general guide. Backup your Virtual Machine (VM) Before...
habibzain
35 sec read

Easy Setup Logrotate Nginx Ubuntu

Log rotation is an important aspect of managing log files on a Linux system, including those generated by Nginx. Logrotate is a utility that...
habibzain
1 min read

Leave a Reply

Your email address will not be published. Required fields are marked *

Never miss good article from us, get weekly updates in your inbox