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
Find the directory of the php.ini
directory. This will usually be etc/php.ini
.
The location of the php.ini
file can vary depending on the operating system and how PHP was installed. 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
Once you have got php.ini file path. Now, you need to open php.ini file and add the line “memory_limt =” with limit; is 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.