Skip to content
PHP Logo

How can one increase the memory size allocated to a PHP script to avoid the "Allowed memory size exhausted" error?

To increase the memory size allocated to a PHP script and avoid the "Allowed memory size exhausted" error, you can update the `memory_limit` directive in your php.ini file or increase it programmatically using `ini_set('memory_limit', '256M');` within your PHP script.

php
// Increase memory limit programmatically
ini_set('memory_limit', '256M');

// Your PHP script code here