where to enable php slow log in ispconfig + nginx + ubuntu 18.04?

Discussion in 'Installation/Configuration' started by skysky, Apr 17, 2022.

  1. skysky

    skysky Member

    Hi
    I am running multi ver php with ispconfig, and I have an api that calls to DB to returns json data for mobile app. but the api is running very slow somehow. I run the sql directly in mysql, it takes 400ms. but get the same sql data from the php api (running php 7.4) takes 6 seconds. running the same api and data on another server without ispconfig takes 1 second to return the json.

    I am trying to troubleshoot this issue, and wonder where to enable php slow log in ispconfig environment.
    I google, and found below,
    edit the PHP-FPM pool configuration, e.g. /etc/php-fpm.d/example.com.conf and add directives specifying the desired location of the slow log file and the time it takes for a script to run for it to be logged:
    slowlog = /srv/www/example.com/logs/slow.log
    request_slowlog_timeout = 3s

    but it does not match my server. there is no /etc/php-fpm.d, and there is something like this
    /etc/php/7.4/fpm/pool.d

    thanks.
     
  2. Jesse Norell

    Jesse Norell Well-Known Member Staff Member Howtoforge Staff

    Add the config lines to "Custom php.ini settings" under the website Options tab.
     
  3. kresimir

    kresimir New Member

    Hi, I know this is old question.. but I hope this will help some future googler..

    I'm pretty sure Jesse is not correct when said to input `pfm` directive for slow log > into php.ini field in admin.
    This example directive
    `slowlog = /srv/www/example.com/logs/slow.log
    needs to be in for example in web8 conf file
    `/etc/php/8.1/fpm/pool.d/web8.conf`

    So you need to be either filled in config file manualy or core team should add that kind of field to be easier to manipulate in the future. I'm prersonally for the last one because that would give us more power to fine-tune per site all fpm aspects! (Also config will not be overwriten on any site update)
     
  4. nhybgtvfr

    nhybgtvfr Well-Known Member HowtoForge Supporter

    the web*.conf files are created by the system.. they may be recreated anew if you resync the user/website account.. any changes you make manually will get removed, and i'm not aware of any way to make any such file changes permanent, apart from editing the template file, which would then get applied to every website.

    @Jesse Norell solution will survive account / website resyncs, and would apply only to websites where you explicitly add this directive.
     
    ahrasis likes this.
  5. kresimir

    kresimir New Member

    I only pointed that Jesse solution will not work under custom php.ini field (IMHO)
     
  6. skysky

    skysky Member

    I confirmed putting slow log setting in custom php.ini field did not work.
    ISPconfig would save the setting like this in the webx.conf file.
    php_admin_value[slowlog] = /var/log/ispconfig/httpd/mydomain.com/phpslow.log
    php_admin_value[request_slowlog_timeout] = 10s

    I have to manually edit the webx.conf file, and insert and saved.
    slowlog=/var/log/ispconfig/httpd/mydomain.com/phpslow.log
    request_slowlog_timeout=10s

    then sudo systemctl restart phpX.X-fpm
     
  7. till

    till Super Moderator Staff Member ISPConfig Developer

    That's because slowlog and request_slowlog_timeout are not php.ini settings, means they are no settings that are found in a php.ini file and the custom php.ini field is only for such settings that belong into the php.ini. But we can add some code to parse these two options out of the php.ini content and add them directly into the pool file. Feel free to open a feature request for that at git.ispconfig.org.
     

Share This Page