Skip to content

Instantly share code, notes, and snippets.

@skwid138
Last active June 23, 2020 13:33
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save skwid138/d24a867f61c34036bd420e40df1c8c87 to your computer and use it in GitHub Desktop.
Save skwid138/d24a867f61c34036bd420e40df1c8c87 to your computer and use it in GitHub Desktop.

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