What could be causing the "FATAL ERROR: memory limit exhausted" issue in PHP scripts?

The "FATAL ERROR: memory limit exhausted" issue occurs when a PHP script consumes more memory than the limit set in the php.ini configuration file. To solve this issue, you can increase the memory_limit value in the php.ini file or directly in your script using the ini_set() function.

// Increase memory limit in PHP script
ini_set('memory_limit', '256M');