Use mod_php7.c instead of mod_php5.c for PHP 7
Example
<IfModule mod_php7.c>
php_value max_execution_time 500
</IfModule>
There's probably a limit set in your webserver. Some browsers/proxies will also implement a timeout. Invoking long running processes via an HTTP request is just plain silly. The right way to solve the problem (assuming you can't make the processing any faster) is to use the HTTP request to trigger processing outside of the webserver session group then poll the status via HTTP until you've got a result set.
well, there are two way to change max_execution_time.
1. You can directly set it in php.ini file.
2. Secondly, you can add following line in your code.
ini_set('max_execution_time', '100')
Well, since your on a shared server, you can't do anything about it. They usually set the max execution time so that you can't override it. I suggest you contact them.
Add these lines of code in your htaccess file. I hope it will solve your problem.
<IfModule mod_php5.c>
php_value max_execution_time 259200
</IfModule>
This is old question, but if somebody finds it today chances are php will be run via php-fpm and mod_fastcgi. In that case nothing here will help with extending execution time because Apache will terminate connection to a process which does not output anything for 30 seconds. Only way to extend it is to change -idle-timeout in apache (module/site/vhost) config.
FastCgiExternalServer /usr/lib/cgi-bin/php7-fcgi -socket /run/php/php7.0-fpm.sock -idle-timeout 900 -pass-header Authorization
More details - Increase PHP-FPM idle timeout setting
Try to set a longer max_execution_time
:
<IfModule mod_php5.c>
php_value max_execution_time 300
</IfModule>
<IfModule mod_php7.c>
php_value max_execution_time 300
</IfModule>
Source: Stackoverflow.com