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.iniCommonly, php.ini located here:
- On Linux:
/etc/php/php.ini(for system-wide settings) or/path/to/your/php.ini(for user-specific settings). - On Windows:
C:\php\php.iniorC:\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
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) orhttpd -k restart(on Windows). - On Nginx, use
sudo service nginx restart(on Linux) ornginx -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.