Home » PHP » increase execution time file size memory limit in php.ini

increase execution time file size memory limit in php.ini

How to increase max execution time, file upload size, memory limit in php.ini file and htaccess file? When you are executing large file you have to seen Fatal error: Maximum execution time of 30 seconds exceeded in…., Fatal Error: Allowed memory size of 8388608 bytes exhausted…. etc.In this post is describing how to solve this error using php.ini file or htaccess file.

increase max_execution_time in php.ini file

Put this code in your file at the top.

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

You can put this in the php.ini file.
max_execution_time = 30 ;

increase max_execution_time using htaccess file



php_value max_execution_time 259200

Increase post_max_size, upload_max_filesize,memory_limit,max_execution_time,max_input_time,session.gc_maxlifetime



php_value post_max_size 5M
php_value upload_max_filesize 5M
php_value memory_limit 300M
php_value max_execution_time 259200
php_value max_input_time 259200
php_value session.gc_maxlifetime 1200

WordPress

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


define('WP_MEMORY_LIMIT', '64M');
set_time_limit(0); // at the top

increase execution time in wordpress

Drupal

If drupal, sites/default/settings.php

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

Other frameworks

If you are using other frameworks,

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

Tags

Similar posts