By default, a PHP script can allocate up to 128 megabytes of memory. You can modify this limit by changing the memory_limit directive in an .htaccess file.
To change the PHP memory limit, follow these steps:
- Login to cPanel
- Then go to File Manager from cPanel.
- Now go to your document root and open .htaccess file by right click. Then click on the “Edit”
- Now put the following code. Replace xxx with the new memory limit value that you want to set, in megabytes:
php_value memory_limit xxxM
Save the changes to the .htaccess file and exit the text editor.
To verify that the new setting is active, create a PHP test file that contains the following code in the same directory where the .htaccess file is located:
<?php phpinfo(); ?>