Maintenance mode

Understanding PHP Memory Limits in WordPress

1. Your server run out of space

Servers run multiple processes and store tons of logs and other files. it might happen that at some point you run out of space. So let’s see how we can find those big files and remove them

sudo find /var/log -type f -printf '%s %p\n' | sort -nr | head -10 

This command is going to display 10 largest files inside /var/log folder. You can increase the number of files displayed or change the folder.

Then you can decide whether that file can be removed or not.

2. Your PHP.ini configuration does not allow to use much space

PHP sets by default low values for memory usage, so we need to check them in order to let us use more space.

locate php.ini

This will display the location of your php.ini file. It could display more than path in case you have several versions of php installed. Ensure you are choosing the right one for your WordPress site. Now edit it and set memory_limit = 128MB. Obviously this value cannot be greater than your server memory.

Once you are done, save the file and restart php service

sudo service php8.1-fpm restart

Artículos populares

Deja una respuesta

Tu dirección de correo electrónico no será publicada. Los campos obligatorios están marcados con *