php.ini - location

Discussion in 'General' started by smokinjo, Apr 27, 2020.

  1. smokinjo

    smokinjo Member HowtoForge Supporter


    I ma trying to find the php.ini file because I need to display errors for debugging purposes for a software.
    I used the perfect install for debian 9.x, mysql, apache, dovcecot.

    I found an old forum post for ubuntu:
    It is 8 years old, and speaks of php 5.x. I am using 7.0.
    It speaks of 2 php.ini files.

    I also found the location of one of the php.ini files from the phpinfo page in my software:

    When I turn the display error on, I load up the PHP info display page, and it is still turned off:
    display_errors = On

    I restarted apache.

    When I load up the phpinfo page, display error is still off.

    I presume that I am modifying the wrong php.ini file.


  2. nhybgtvfr

    nhybgtvfr Well-Known Member HowtoForge Supporter

    the locations depend entirely on how php was installed.
    you've already found /etc/php/7.0/apache2/php.ini

    there should also be /etc/php/7.0/cli/php.ini, /etc/php/7.0/cgi/php.ini and /etc/php/7.0/fpm/php.ini

    for other versions of php, if you compiled and installed them, they're probably in /opt/php<version>/ if following the tutorials, otherwise whatever path you chose when compiling them.
    if you used the ondrej php repo, then they'll be in /etc/php/5.6/apache2/php.ini, /etc/php/7.1/apache2/php.ini,
    changing version numbers as required for php7.2, php7.3 and php7.4, and changing apache2 for cgi/cli/fpm as appropriate.
    which one you want to edit depends entirely on what php version and handler you have set on each individual website.

    or you could open the site settings in the control panel, go to the options tab, and add the changes you want to apply in the custom php.ini settings field which will get applied to a custom php.ini file, specific to that website, in /var/www/conf/<webid>/
  3. smokinjo

    smokinjo Member HowtoForge Supporter


    As I stated, I used the perfect ispconfig install based on debian, 9.x, mysql, apache, dovecot.
    Nothing custom or complied anywhere.

    I will try the proposed php.ini files in the cgi, fpm and cgi folders.

  4. smokinjo

    smokinjo Member HowtoForge Supporter

    I was able to find and modify the php.ini files as follows:


    I restarted apache after each change, and the display_errors is still turned off after looking at the php info page.

    Might there be one/some that I missed?]

    Thanks for your ideas.

  5. nhybgtvfr

    nhybgtvfr Well-Known Member HowtoForge Supporter

    well, one way to find out...

    sudo su
    cd /
    find . -type f -name php.ini

    that should find every instance of php.ini on the server.. could take a while to finish.....
    although, just out of interest, before you do that, have you tried restarting the php services yet?
  6. Jesse Norell

    Jesse Norell ISPConfig Developer Staff Member ISPConfig Developer

    Restarting apache only affects mod_php, which you shouldn't even be using nowadays, you'll need to restart the PHP servers as @nhybgtvfr suggested. FWIW, you can use phpinfo to see the php config file in use.
  7. smokinjo

    smokinjo Member HowtoForge Supporter

    Hello Jesse

    Thanks for the feedback.

    So, I should reboot the php servers.

    When I looked up restarting php servers the only7 references I get are to restart apache.
    You are saying that this i snot enough.

    So, how does one restart the PHP servers on debian?


  8. Steini86

    Steini86 Active Member

    If you are using php-fpm (what you should), then use:
    systemctl reload php-fpm (just reload the config)
    systemctl restart php-fpm (restart the service)

    However, I think this is all not what you really want. What you want to do is a bit hidden in the first answer. In ISPC, go to the website config -> options -> php.ini setting. Paste your changes there and apply.
    ISPConfig will take care of writing this to the right ini file and restart the services.
  9. smokinjo

    smokinjo Member HowtoForge Supporter

    Two points replying to the comments from stein.

    1 - when I try the restart or reload form teh php-fpm, I get:
    Failed to restart php-fpm.service: Unit php-fpm.service not found.

    My sites (maybe a dozen) were about 8 already said php-fpm. The ohters, were something else.
    I did nto understand this setting, so I did nto mess with it too much. I shoudl chang emy domains to php-fpm?

    2 - If I want to change the display error to on, do I just add the desired setting to the Custom php.ini settings field?
    My desired setting is:
    display_errors = On

  10. Steini86

    Steini86 Active Member

    To find out how the service is named on your system, execute: "systemctl list-unit-files | grep fpm". Could be php7.0-fpm or something.
    php-fpm is the way to go at the moment, yes. (It is faster)
    Yes. It is then only valid for that specific web

Share This Page