Custom php.ini with PHP-FPM

Discussion in 'Installation/Configuration' started by jmacorigh, Jan 26, 2018.

  1. jmacorigh

    jmacorigh New Member

    Aloha everybody !
    I've installed PHP 7.1 FPM with ondrej PPA on my ISPConfig 3.1.2.
    I've setted it up in "System > Additional PHP Versions" and I've activated it for my website. Everything is fine there. I've correctly PHP 7.1 FPM on my website.
    I wanted to enable the mongodb driver extension and... nope. I add few lines in "Custom php.ini settings", ISPConfig generate correctly the custom php.ini file in /var/www/conf/ but PHP FPM still use the default php.ini in /etc/php/7.1/fpm/ and not my custom php.ini, so i can't have the mongodb extension..

    Do you have an idea ?

    I've already seen this topic, but doesn't help : https://www.howtoforge.com/community/threads/custom-php-ini-for-php-fpm.77171/

    Thanks by advance,
    Julien
     
  2. till

    till Super Moderator Staff Member ISPConfig Developer

    That's correct, as custom changes in php-fpm mode are added in the php fpm pool file, the files in /var/www/conf/ are for other modes only, so you can not determine from php.ini file name shown in e.g. phpinfo() command or from a file in /var/www/conf/ if they got added or not. If you want to know if they got added, check the fpm pool configuration file. It might also be that the fpm pool could not be restarted so they git not applied. try to restart the pool with systemctl command or reboot the server once.
     
  3. jmacorigh

    jmacorigh New Member

    Hello till, thanks for your answer and sorry for the private message!

    I've restart the pool and nothing, my custom php.ini still doesn't used and it sounds normal when i read your post. So, do you know a proper way to have custom PHP settings for a domain only ?

    Thanks !
     
  4. till

    till Super Moderator Staff Member ISPConfig Developer

    Custom changes are written in the pool file directly in fpm mode. You have to take a look into the php-fpm pool file of that site to see if it contains them. For ecxample on Debian 9, the pool files are in /etc/php/7.0/fpm/pool.d/
     
  5. jmacorigh

    jmacorigh New Member

    Thanks! You're right : I've the good ini file (web6.ini) in /etc/php/7.0/fpm/pool.d/

    When I watch my phpinfo(), I have "Scan this dir for additional .ini files : /etc/php/7.1/fpm/conf.d", or my custom .ini is in /pool.d/, so my file is not scanned :<

    Do I have to create a symbolic link for having web6.ini in /conf.d and getting ot scanned ?
    Or is there a way to add /pool.d/ as a dir for additional .ini files ?

    What's the correct way ?
     
  6. till

    till Super Moderator Staff Member ISPConfig Developer

    You mix up php.ini files with the fpm starter file. The file in pool.d is not a php.ini file, it is the php-fpm starter and this is never listed in phpinfo(), so the result that you don't see it there is no indication that is is not applied. Settings from starter file are always included. If the starter file would not have been read then you won't be able to use php-fpm in that site as all as it would not be running then.
     
  7. jmacorigh

    jmacorigh New Member

    Well, I understand better what happen now, thank a lot.

    I didn't do the test but when I put post_max_size=15M in my Custom php.ini settings on the ISPConfig interface, I have the correct modification done : post_max_size was 8M and it's 15M now, so it works correctly.

    When I watch the /pool.d/web6.conf generated, I can see my custom lines :
    php_admin_value[extension] = mongodb.so
    php_admin_value[post_max_size] = 15M
    So my conclusion is just the line php_admin_value[extension] = mongodb.so has no effect.
    Should I create a /etc/php/7.1/mods-available/mongodb.ini with extension=mongodb.so manually (and the symbolic link in conf.d/ too) ? Is that the correct way ?
     
  8. till

    till Super Moderator Staff Member ISPConfig Developer

    My guess is that extension's can't be loaded like that.

    That's probably the better way to include the extension globally in the same way the other extensions are loaded.
     

Share This Page