Skip to content

Instantly share code, notes, and snippets.

@skwid138
Last active Jun 23, 2020
Embed
What would you like to do?

PHP Memory Limit

In PHP Script

  • Specified ammount of memeory ini_set('memory_limit','2048M');
  • Unlimited memory ini_set('memory_limit', '-1');

In WordPress

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

In php.ini

memory_limit = 256M

In .htaccess (not recomended... didn't read why)

php_value memory_limit 256M

Other useful php script memory related variables

  • Bump the max time a script is allowed to run ini_set('max_execution_time', 480);

Other useful php.ini memory related variables

  • The max file size that's allowed to be uploaded upload_max_filesize = 12M
  • The max size a POST request can be post_max_size = 13M
  • Allow file uploadsfile_uploads = On
  • How long a script is allowed to execute max_execution_time = 180

Other useful .htaccess memory related variables

  • The max file size that's allowed to be uploaded php_value upload_max_filesize 12M
  • The max size a POST request can be php_value post_max_size 13M
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment