Increase memory for PHP using .htaccess

If you see the following error on a PHP script, you can easily fix it by increasing the allowed memory to your PHP script.

Fatal error: Allowed memory size of 33554432 bytes exhausted (tried to allocate 113 bytes) in

To do that, simply add the line below to a .htaccess file in your public_html folder

php_value memory_limit 256M

You can then verify this using a test PHP file which should have the code below. The Local Value column will reflect the increased value that you set.

< ?php phpinfo(); ?>

Did you find this article useful?