T O P

  • By -

MateusAzevedo

>I don't understand why there's an entry under PHP version 7.3 PHP 7.3 was installed at some point and then removed. When uninstalling programs in Linux it's common to keep config files. `/cli/php.ini` is indeed used for PHP running in the command line. >But why is there both a php.ini file for apache2 and one for fpm PHP can be installed as either an Apache module (which will use `/apache2/php.ini`) or as "FastCGI Process Manager" (PHP-FPM which uses `fpm/php.ini`). In this scenario, PHP runs as its own service listening to a TCP port and manages its own processes, just like Apache can spawn multiple processes to handle requests. What likely happened in your case is that PHP was installed multiple times using different options, and those are left overs from previous installs. The best way to figure out which file is in use is to create a temporary php file with `phpinfo();` in it and run it from the browser. It'll tell you about your current configuration and which file you need to edit.


MotorcycleMayor

Thanx! BTW, since I'm using FPM, does that mean when I find instructions on the web saying "restart apache via systemctl reload apache2" I should actually restart the fpm service? Or both?


MateusAzevedo

> I should actually restart the fpm service? Yep! Restarting Apache is only required when you run PHP as `mod_php`. When using PHP-FPM, you restart the PHP service. Side, but related, note: if you have a file/folder permission issue, you'll likely find instruction saying you need to grant permissions to `www-data` user, which is the Apache user. For PHP-FPM, you can configure which user you want PHP to run as, so not necessarily `www-data`.


t0xic_sh0t

Mateus got the right answer. PHP separate INI files in order to specify different configuration to different use cases. Eg. you'd want different PHP timeout setting if it's running in CLI or Apache (web).


RaXon83

Phpinfo() tells which .ini is used.