And again another question, now dealing with the PHP memory_limit…
When using Apache based servers I hat to change the PHP memory_limit values several times within the php.ini file. While optimizing my WordPress installation within my NGinx server surroundings I noticed that the PHP memory limit is set to 128 MB - which could be not sufficient for some other web applications I intend to install and use.
Following several guides I changed the PHP version used by NGinx and WordPress from 8.2 to version 8.4, deleting the older versions with success. I made sure PHP-FPM is installed and running.
Whenever opening the php.ini file I noticed following directive:
”memory_limit: -1”
No matter to what amount I changed it (always using 128M, 512M or alike) PHP info got stuck on 128M (and yes, I always restarted PHP and NGinx after changing the php.ini file). WordPress suggests installation of page cache plugins (which works ok to some degree) but I am not a dedicated fan of those plugins. Nevertheless other web based apps demand a minimum of 512M or even more.
I did an intense search but I still did not find any documentation that explains that “-1” value. I triple-checked that my NGinx installation makes use of PHP 8.4 (fastcgi_pass unix:/run/php/php8.4-fpm.sock;) and whenever checking the PHP settings I was sure to edit the right php.ini. - so what am I missing here? Any hint on this?
I am not a PHP expert myself, but a cursory Google search seems to indicate memory_limit: -1 fundamentally means that PHP will not have an actual memory limit and thus can use as much memory as necessary/possible (see PHP: Description of core php.ini directives - Manual for more info).
While reading Your provided second link the solution was more or less obvious to some degree. The good old way to make a PHP info file led me to the actual ini used by my PHP 8.4 installation (different location as expected). Now everything is fine, memory limit raised to the desired amount.
Digging deeper into that “-1” thing I guess that this is some sort of “alias” or “sym link” function within PHP pointing to the ini file that actually defines the amount of memory. Not completely sure about this but as all ini files of PHP version 8.1, 8.2 and 8.3 formerly installed in my system make use of that “-1” definition I am coming to that conclusion. In fact the ini file used is NOT located in for example /etc/php/8.4/php.ini but in /etc/php/8.4/fpm/php.ini.
In the end it doesn’t matter what and how many versions of PHP are installed as long as the right ini file within the fpm of the actually used PHP version is edited.
Again thank You very much for giving a helping hand again! I am still learning a lot about NGinx, doing all this in my spare time. Every day new things to do come to my mind when working on my little server box. I should start using a mind mapping app, I guess….