Multiple versions of php.ini

Discussion in 'Installation/Configuration' started by cavallad, Feb 9, 2024.

Tags:
  1. cavallad

    cavallad New Member

    I thought I'd share my recent experience of customizing the php.ini file(s) associated with a particular setup through the ISPConfig admin panel.
    I run a small server for a handful of websites including a couple of Nextcloud installations on Ubuntu 22.04 LTS with the setup based on the Perfect server tutorial [since installing, the Ubuntu has been upgraded from 20.04 to 22.04 LTS].
    The Nextcloud installations complained that opcache was misconfigured and the settings for opcache.memory_consumption and opcache.interned_strings_buffer needed to be increased. These were just warnings, but others have had significant difficulty clearing them.
    Now I know why.
    The problem relates to the way the 'Options' tab on the ISPConfig admin panel changes the php.ini file.
    Specifically, this tab changes the php.ini file in /var/www/conf/[#userid]. But there are other php.ini files in /etc/php/8.2/fpm (when running under php-fpm ver 8.2) and in related files linked from the conf.d subdirs of this folder.
    For some of the options, it's perfectly fine to make changes in the 'Options' tab, since the changes to the /var/www/conf/[#userid]/php.ini file will be adopted by the server.
    For other options, notably those related to opcache, you need to make the changes directly in the /etc/php/8.2/fpm subdirs. In the case of opcache settings, this is linked from /etc/php/8.2/fpm/conf.d/10-opcache.ini to /etc/php/8.2/mods-available/opcache.ini.
    You therefore need to make the required changes to opcache.memory_consumption and opcache.interned_strings_buffer in this file, and then the warnings go away.
    I though this might be useful to the forum for other customizations.
     
  2. till

    till Super Moderator Staff Member ISPConfig Developer

    Changes for PHP-FPM get written to the pool file and not /etc/php/8.2/fpm/php.ini and also not in /var/www/conf/[#userid]; just check the pool files, and you see that all your changes get properly applied there. What you described above mixes up different PHP modes as you tried to apply your knowledge about old FastCGI mode to PHP-FPM, which can't work as the configuration is completely different and does not use php.ini files for the customization anymore. You can not change settings per site for PHP-FPM in /etc/php/8.2/fpm/php.ini as PHP-FPM does not support multiple php.ini files for the same PHP versions, and you can also not use /var/www/conf/[#userid] for the same reason. The customizations get written to the pool file only. Separate php.ini files are only used for FastCGI mode, they are not needed for PHP-FPM.
     
  3. cavallad

    cavallad New Member

    Thanks, @till. In that case, I may have a misconfiguration, since changes to the custom php.ini settings in the ISPConfig admin panel are definitely appearing in the /var/www/conf/[#userid]/php.ini files and not in the /etc/php/8.2/fpm/pool.d/[#userid].conf file.
    I am not running these sites under Fast-CGI. Instead they are running under php8.2-fpm.
     
  4. till

    till Super Moderator Staff Member ISPConfig Developer

    That's strange. Do you use Apache or Nginx? I guess Apache, as you have the FastCGI option available.
     
  5. till

    till Super Moderator Staff Member ISPConfig Developer

    Debian 12, Apache, installed with auto-installer.
    On first website tab:
    2024-02-09 19_21_13-ISPConfig.png
    On options tab
    2024-02-09 19_21_30-ISPConfig.png
    Pool file:
    2024-02-09 19_21_45-192.168.0.100 - PuTTY.png
     
  6. till

    till Super Moderator Staff Member ISPConfig Developer

    The file:

    Code:
    root@server1:/etc/php/8.2/fpm/pool.d# ls /var/www/conf/web1/
    php.ini
    seems to get always written as well, but it is not used in php-fpm mode.
     
  7. cavallad

    cavallad New Member

    I guess the issue for me is that the Custom php.ini settings from the ISPConfig panel do not get written to the pool file.
    The file I have for /etc/php/8.2/fpm/pool.d/[#userid].conf is exactly the same as you posted, but does not incorporate the customizatrion.
    And yes, I am running Apache/2.4.52 (Ubuntu).
    One thing that is also strange is that the first line of the pool conf file says:
    'listen = /var/lib/php8.1-fpm/web31.sock', even though the ISPConfig panel specifies php8.2-fpm.
     
  8. cavallad

    cavallad New Member

    I think I've resolved my problem, at least as far as ISPConfig is concerned. I undertook a Tools>ReSync of the websites, and checked in the pool conf files that the various customizations were included.

    However, in order to get the Nextcloud warning to go away, I still need to put the following settings into the /etc/php/8.2/fpm/conf.d/10-opcache.ini file.
    opcache.memory_consumption = 512
    opcache.interned_strings_buffer = 32

    If these settings are only included in the website config in ISPConfig admin panel (and then verified to appear in /etc/php/8.2/fpm/pool.d/[#userid].conf), the warning persists. I suspect this is a Nextcloud problem.
     
  9. till

    till Super Moderator Staff Member ISPConfig Developer

    That's perfectly fine as 8.1 here is not a specific PHP version as I mentioned many times in the forum. The path /var/lib/php8.1-fpm/ is the global PHP socket directory of your Linux system, it contains the sockets for all PHP versions.
     

Share This Page