How to deal with 'memory exhausted error in php'?
Example:
while(true) {
$data[] = str_repeat('A', 1024);
}
Script consuming more memory than allocated in the PHP configuration.
Solution:You can increase the memory limit in the php.ini configuration. However, it's often better to optimize the script to use memory more efficiently.
ini_set('memory_limit', '256M'); // Set memory limit to 256MB
// Rest of the script