Skip to Content

Increase script execution time in Ubuntu and CentOS

How to increase script execution time in Ubuntu and CentOS?

Open the php.ini file and change the max_execution_time to 300 seconds (5 minutes). Refer the below step to change script execution time in Ubuntu. Replace the PHP version from the below command.

root@ubuntu ~]# php -v

PHP 7.4.3 (cli) (built: Aug 17 2022 13:29:56) ( NTS )

root@ubuntu ~]# vim /etc/php/7.4/apache2/php.ini

max_execution_time = 300

root@ubuntu ~]# vim /etc/php/7.4/cli/php.ini

max_execution_time = 300

Open the php.ini file and change the max_execution_time to 300 seconds (5 minutes). Refer the below step to change script execution time in CentOS. Replace the PHP version from the below command.

root@centos ~]# php -v

PHP 7.4.3 (cli) (built: Aug 17 2022 13:29:56) ( NTS )

root@centos ~]# vim /etc/php.ini

max_execution_time = 300