Through this tutorial, you will learn how to fix PHP: fatal error: allowed memory size of 8388608,16777216, 33554432, 67108864, 134217728, 268435456, 536870912, 1073741824 bytes exhausted PHP, laravel, codeIgniter, WordPress in linux ubuntu, windows, mac.
How To Fix PHP Fatal error: Allowed memory size of bytes exhausted codeigniter, Laravel, WordPress
Steps to fix laravel, codeIgniter, wordpress PHP fatal error allowed memory size of 8388608,16777216, 33554432, 67108864, 134217728, 268435456, 536870912, 1073741824 bytes exhausted in linux ubuntu, windows, mac:
- Step 1 – Open
php.ini
- Step 2 – Edit
php.ini
- Step 3 – Save PHP.ini
Step 1 – Open php.ini
Search the the php.ini
file in etc folder on your windows, ubuntu or mac os system.
The location of the php.ini
file can vary depending on the operating system. Here’s how to find the php.ini
file on Ubuntu, Windows, and macOS:
Ubuntu:
- Open a terminal.
- Run the following command to find the location of the
php.ini
file:- php -i | grep “Loaded Configuration File”
- The output will display the path to the
php.ini
file.
Windows:
- Open a command prompt.
- Run the following command to find the location of the
php.ini
file:- php -i | findstr /C:”Loaded Configuration File”
- The output will display the path to the
php.ini
file.
macOS:
- Open a terminal.
- Run the following command to find the location of the
php.ini
file:- php -i | grep “Loaded Configuration File”
- The output will display the path to the
php.ini
file.
Step 2 – Edit php.ini
Edit php.ini file and add the line “memory_limt =” with limit; as follows:
ini_set('memory_limit', '1024M');
Step 3 – Save PHP.ini
Finally, You adjust the value accordingly and save it. And restart your server.