Need some explanation about php settings

Discussion in 'Installation/Configuration' started by Poliman, Jul 24, 2018.

  1. Poliman

    Poliman Member

    I have server created based on Perfect Server tutorial. I am confused about few php.ini files. Inside /etc/php/7.0/ are directories like apache2, cgi, cli, fpm and mods-available. Inside first four is php.ini file. What's the difference between them? For example to change size of database imported by Phpmyadmin from default 2MB to something more I had to change values in php.ini from apache2 directory. Changes in another php.ini files don't do anything. Executing command php --ini gives result:
    [email protected]:~# php --ini
    Configuration File (php.ini) Path: /etc/php/7.0/cli
    Loaded Configuration File:         /etc/php/7.0/cli/php.ini
    Scan for additional .ini files in: /etc/php/7.0/cli/conf.d
    Additional .ini files parsed:      /etc/php/7.0/cli/conf.d/10-mysqlnd.ini,
    so I thought /etc/php/7.0/cli/php.ini is default file and settings from him should work but it doesn't. I would like to use php-fpm for WordPress website set under ISP. If I would like to change some php settings for this website should I edit /etc/php/7.0/fpm/php.ini, yes?

    Is there any preferred php handler?
    Last edited: Jul 24, 2018
  2. till

    till Super Moderator Staff Member ISPConfig Developer

    apache2: mod_php
    cgi: php-cgi and php-fcgi
    cli: commandline PHP
    fpm: php-fpm

    so the apache2 php.ini file was the correct one, but you have to restart apache afterwards. and you can't test it by using commandline php of course as commandline php iuses a different php.ini than mod_php.

    The recommended php handler for websites is php-fpm
  3. Poliman

    Poliman Member

    Thank you till for answer. How could I determine that exactly for phpmyadmin changes I should change php.ini from apache2 directory?
  4. ISPConfig Developer ISPConfig Developer

    yes, using the howto your phpmyadmin is using mod_php, which is controlled by apache2 php.ini
  5. Poliman

    Poliman Member

    Thank you for answer but where I am able to find this enigmatic howto? ;) And what about, for example, some websites or mysql etc?
  6. ISPConfig Developer ISPConfig Developer

    I was referring to the perfect ispconfig server howto.
    I don't know what examples you think of and in which context?
  7. Poliman

    Poliman Member

    Thank you for answer. I thought that each software which uses php have some information about required php handler. :)
  8. ISPConfig Developer ISPConfig Developer

    na, almost every phpscript ( no matter if u spent money big time or use wordpress + extensions ) works more or less as the following principle:
    try upgrading your php-version ; something stopped working? no error? try adding some common modules like -curl, -imap ..... still not working? oh well, go down a version and continue if it works again or fix the code yourself if its not encoded ^^

    The software with accurate requirements beeing minimalistic and correct ... rare
  9. Poliman

    Poliman Member

    Mhm, got it. Appreciate detailed answer. But I suppose there is some recommendations to use specific handler with specific software (easier or more complexity). ;)
  10. ISPConfig Developer ISPConfig Developer

    well there are some ( really old and horrific bad coded ) rare scripts out there needing mod_php or apache.

    mod_php easiest,
    php-fpm mid,
    fastcgi complex and not beeing developed anymore anyway
    fcgi complex

    performancewise (throughput)
    mod_php, fastest
    php-fpm, depends on sockets/tcp-ip local or remote php-processes but still very fast
    fastcgi, fast
    fcgi, I don't know, but probably almost compareable to fastcgi

    mod_php huge memory usage and loaded in each apache process, even if processing non-php content
    php-fpm, excellent - allows good fine-tuning + supports dynamic increase/decrease of php-processes based on load
    fastcgi pretty good
    fcgi uh well no figures on that really

    mod_php causes issues with wrong file-permissions and general security, you would want to use some hacks like mpm_itk to isolate users, however mpm_itk is not best option to serve webs
    php-fpm, might want to chroot aswell, maybe need some fix if using sockets, depends on system but affects admins only and easy fix
    fastcgi can be a nightmare if you do it wrong
    fcgi same
    all non mod_php need additional configuration which wasnt documented very well until recent distro updates... missgin authorization headers and alike

    these are very basic and probably not fit for everyone thoughts....
    I'd recommend apache2 mpm_worker, php-fpm
    if you have apache 2.4.34+ you could also try mpm_event if you use keepalive and want to trade some memory usage with cpu usage
    Poliman likes this.
  11. Poliman

    Poliman Member

    I am excited. Thank you! ;)

Share This Page