Increase Max_Execution_Time in PHP

How to increase maximum execution time in php

ini_set('max_execution_time', '300'); //300 seconds = 5 minutes
ini_set('max_execution_time', '0'); // for infinite time of execution

Place this at the top of your PHP script and let your script loose!

Taken from Increase PHP Script Execution Time Limit Using ini_set()

How to increase the execution timeout in php?

You need to change some settings in your php.ini:

upload_max_filesize = 2M 
;or whatever size you want

max_execution_time = 60
; also, higher if you must - sets the maximum time in seconds

Where your PHP.ini is located depends on your system environment. For more information: http://php.net/manual/en/ini.list.php

How can I increase max_execution_time in Bitnami WP Multisite?

Bitnami Developer here,

In order to change the max_execution_time parameter in your Bitnami WordPress image, you have to follow these steps.

  • Change the max_execution_time value to 300 in /opt/bitnami/php/etc/php.ini. Note that you pointed to /opt/bitnami/php/php.ini in your message.

  • Restart you Apache and php-fpm services.

    sudo /opt/bitnami/ctlscript.sh restart apache
    sudo /opt/bitnami/ctlscript.sh restart php-fpm

Once this is done, you can check your change using phpinfo(). Create a test.php file in /opt/bitnami/apps/wordpress/htdocs with the following content:

<?php
phpinfo();
?>

Then, you can check your new value in http://your-ip/test.php

Sample Image

Sample Image

Set maximum execution time in PHP

You can use 0 :

max_execution_time = 0     

That will disabled the limitation. Don't forget to restart apache after.

You can also user the PHP version :

<?php set_time_limit(0); ?>

Increase max execution time for php

PHP file (for example, my_lengthy_script.php)

ini_set('max_execution_time', 300); //300 seconds = 5 minutes

.htaccess file

<IfModule mod_php5.c>
php_value max_execution_time 300
</IfModule>

More configuration options

<IfModule mod_php5.c>
php_value post_max_size 5M
php_value upload_max_filesize 5M
php_value memory_limit 128M
php_value max_execution_time 300
php_value max_input_time 300
php_value session.gc_maxlifetime 1200
</IfModule>

If wordpress, set this in the config.php file,

define('WP_MEMORY_LIMIT', '128M');

If drupal, sites/default/settings.php

ini_set('memory_limit', '128M');

If you are using other frameworks,

ini_set('memory_limit', '128M');

You can increase memory as gigabyte.

ini_set('memory_limit', '3G'); // 3 Gigabytes

259200 means:-

( 259200/(60x60 minutes) ) / 24 hours ===> 3 Days

More details on my blog

increase php max_execution_time in IIS 7.5

Please check for a hidden .htaccess file on your server and if there is no .htaccess file then you can create one( make sure that there is no hidden htaccess file otherwise it will overwrite) and paste this code.

php_value max_execution_time 259200

You can also refer this url Increase max execution time for php



Related Topics



Leave a reply



Submit