Is my host running PHP-FPM? [SOLVED]

Discussion in 'General' started by helders, Sep 11, 2019 at 3:52 PM.

  1. helders

    helders New Member

    Hello guys,

    First of all i'd like to thank everyone here in advance, this is my first post but i've been following this for a while, you guys are always amazing!

    Now for the question. I have been using PHP-FastCGI for a while but i wanted to try PHP-FPM for some websites. I have PHP5 and PHP7.2 running (followed https://www.howtoforge.com/tutorial/how-to-install-php-7-on-debian/ this tutorial to set it up). They both work fine under FastCGI. My biggest question is, i changed one particular host to use PHP-FPM with PHP7.2, when i access it it's working fine but when i check the phpinfo() under "Server API" it still shows "CGI/FastCGI" and there is nothing there mentioning fpm (except on the configure commands which shows the fpm related options).

    A ps aux | grep php-fpm shows:
    root 558 0.0 0.7 332120 30164 ? Ss Jul30 1:59 php-fpm: master process (/opt/php-7.2/etc/php-fpm.conf)
    www-data 41991 0.0 0.2 332120 9764 ? S 10:20 0:00 php-fpm: pool www
    www-data 41992 0.0 0.2 332120 9764 ? S 10:20 0:00 php-fpm: pool www
    root 50987 0.0 0.0 11108 936 pts/0 S+ 10:44 0:00 grep php-fpm

    Also, after changing it to FPM, it did create a webX.conf at /opt/php-7.2/etc/php-fpm.d for the host i changed.

    So now i'm not sure if that host is running under FPM or not, i do trust ISPConfig that if i changed the setting to FPM it would change the host to it, but how can i make sure it's working under FPM? I tried googling arround but couldn't find anywhere a way to make sure the host is under FPM or still under FastCGI.

    Edit: running perfect server configuration with Debian9 + apache2

    SOLVED: Problem was that i had created SSL certificates by shell and not the web interface of ISPConfig. After troubleshooting i fixed the errors for letsencrypt not being able to create the certificates and everything worked like it should. Thanks guys.
     
    Last edited: Sep 11, 2019 at 10:42 PM
  2. Jesse Norell

    Jesse Norell Well-Known Member

    That is the interface between the web server and the php interpreter, and is how apache communicates with the php-fpm daemons.
     
  3. helders

    helders New Member

    Hey jesse,

    Yeah I read about that but I saw on same tutorials it showing FPM there, is there any way to be sure that the host is really under FPM or is still on FastCGI?
     
  4. till

    till Super Moderator Staff Member ISPConfig Developer

    Check the vhost config file if it contains php-fpm or fcgi configuration. Or stop the php fpm daemon, if the site still works, then it does not use php-fpm :)
     
    Richard Foley likes this.
  5. helders

    helders New Member

    Hey till :)

    It only shows the # suexec enabled and # php as fast-cgi enabled part on the vhost file.

    I followed the tutorial on point, any ideas?
     
  6. till

    till Super Moderator Staff Member ISPConfig Developer

    Is there a copy of the vhost file in the sites-available folder (not in sites-enabled) with .err file ending? If yes, then the new config could not be written so ispconfig had to revert to the last working config.
     
  7. helders

    helders New Member

    Hey till,

    No, there is no .err file on the sites-avaiable folder. I was checking if fpm service was running with systemctl status php-7.2-fpm.service and got this

    php-7.2-fpm.service - The PHP 7.2 FastCGI Process Manager
    Loaded: loaded (/lib/systemd/system/php-7.2-fpm.service; enabled; vendor preset: enabled)
    Active: active (running) since Tue 2019-07-30 12:15:51 -03; 1 months 12 days ago
    Process: 101152 ExecReload=/bin/kill -USR2 $MAINPID (code=exited, status=0/SUCCESS)
    Main PID: 558 (php-fpm)
    Tasks: 5 (limit: 19660)
    CGroup: /system.slice/php-7.2-fpm.service
    ├─ 558 php-fpm: master process (/opt/php-7.2/etc/php-fpm.conf)
    ├─101161 php-fpm: pool web49
    ├─101162 php-fpm: pool web49
    ├─101163 php-fpm: pool www
    └─101164 php-fpm: pool www

    So it seems to be running ok, also the process list now shows:
    root 558 0.0 0.7 332136 29668 ? Ss Jul30 1:59 php-fpm: master process (/opt/php-7.2/etc/php-fpm.conf)
    web49 101161 0.0 0.2 332128 10516 ? S 12:39 0:00 php-fpm: pool web49
    web49 101162 0.0 0.2 332128 10516 ? S 12:39 0:00 php-fpm: pool web49
    www-data 101163 0.0 0.2 332124 10516 ? S 12:39 0:00 php-fpm: pool www
    www-data 101164 0.0 0.2 332124 10516 ? S 12:39 0:00 php-fpm: pool www
    root 123385 0.0 0.0 11108 1028 pts/0 S+ 13:36 0:00 grep php-fpm

    so seems like it created the process for the host i enabled it for. Also checking the vhost there i found this part:

    <IfModule mod_fastcgi.c>
    <Directory /var/www/clients/client2/web49/cgi-bin>
    Require all granted
    </Directory>
    <Directory /var/www/HOST/web>
    <FilesMatch "\.php[345]?$">
    SetHandler php-fcgi
    </FilesMatch>
    </Directory>
    <Directory /var/www/clients/client2/web49/web>
    <FilesMatch "\.php[345]?$">
    SetHandler php-fcgi
    </FilesMatch>
    </Directory>
    Action php-fcgi /php-fcgi virtual
    Alias /php-fcgi /var/www/clients/client2/web49/cgi-bin/php-fcgi-*-80-HOST
    FastCgiExternalServer /var/www/clients/client2/web49/cgi-bin/php-fcgi-*-80-HOST -idle-timeout 300 -socket /var/lib/php7.0-fpm/web49.soc$
    </IfModule>
    <IfModule mod_proxy_fcgi.c>
    #ProxyPassMatch ^/(.*\.php[345]?(/.*)?)$ unix:///var/lib/php7.0-fpm/web49.sock|fcgi://localhost//var/www/clients/client2/web49/web/$1
    <Directory /var/www/clients/client2/web49/web>
    <FilesMatch "\.php[345]?$">
    SetHandler "proxy:unix:/var/lib/php7.0-fpm/web49.sock|fcgi://localhost"
    </FilesMatch>
    </Directory>
    </IfModule>

    After reading this i guess it is running as it should, right?
     
  8. till

    till Super Moderator Staff Member ISPConfig Developer

    Yes, it is working fine and thats the php-fpm config in the vhost, not fastcgi.
     
  9. helders

    helders New Member

    Would it be normal that after running "systemctl stop php-7.2-fpm.service " the website still works?

    Also i'm trying to enable the FPM status page to check if it's all ok but it doesn't seem to work. I already enabled to config on the www.conf file but it gives me 404 error when i access http://host/php-fpm-status.
     
  10. till

    till Super Moderator Staff Member ISPConfig Developer

    No, PHP should stop working in that site then.

    Try restarting apache and then test again.
     
  11. helders

    helders New Member

    Restarted apache, stopped fpm via systemctl stop php-7.2-fpm.service but site still acessible, this looks wierd
     
  12. till

    till Super Moderator Staff Member ISPConfig Developer

    Maybe you access the site on a different server? The config you posted is for php-fpm.
     
  13. helders

    helders New Member

    Well i noticed that the content of the 100-host.vhost and the host.vhost-le-ssl-conf are different, the one with the SSL (the website used https and enforced it) does not have that part i mentioned above, is only says:

    # suexec enabled
    <IfModule mod_suexec.c>
    SuexecUserGroup web49 client2
    </IfModule>
    # php as fast-cgi enabled
    # For config options see: http://httpd.apache.org/mod_fcgid/mod/mod_fcgid.html
    <IfModule mod_fcgid.c>
    FcgidIdleTimeout 300
    FcgidProcessLifeTime 3600
    # FcgidMaxProcesses 1000
    FcgidMaxRequestsPerProcess 5000
    FcgidMinProcessesPerClass 0
    FcgidMaxProcessesPerClass 10
    FcgidConnectTimeout 3
    FcgidIOTimeout 600
    FcgidBusyTimeout 3600
    FcgidMaxRequestLen 1073741824
    </IfModule>
    <Directory /var/www/HOST/web>
    <FilesMatch "\.php[345]?$">
    SetHandler fcgid-script
    </FilesMatch>
    FCGIWrapper /var/www/php-fcgi-scripts/web49/.php-fcgi-starter .php
    FCGIWrapper /var/www/php-fcgi-scripts/web49/.php-fcgi-starter .php3
    FCGIWrapper /var/www/php-fcgi-scripts/web49/.php-fcgi-starter .php4
    FCGIWrapper /var/www/php-fcgi-scripts/web49/.php-fcgi-starter .php5
    Options +ExecCGI
    AllowOverride All
    Require all granted
    </Directory>
    <Directory /var/www/clients/client2/web49/web>
    <FilesMatch "\.php[345]?$">
    SetHandler fcgid-script
    </FilesMatch>
    FCGIWrapper /var/www/php-fcgi-scripts/web49/.php-fcgi-starter .php
    FCGIWrapper /var/www/php-fcgi-scripts/web49/.php-fcgi-starter .php3
    FCGIWrapper /var/www/php-fcgi-scripts/web49/.php-fcgi-starter .php4
    FCGIWrapper /var/www/php-fcgi-scripts/web49/.php-fcgi-starter .php5
    Options +ExecCGI
    AllowOverride All
    Require all granted
    </Directory>
     
  14. till

    till Super Moderator Staff Member ISPConfig Developer

    Ok, this explains your problem, it is actually not related to ispconfig at all, its caused by certbot. You seem to have used certbot on the shell instead of enabling LE in ISPConfig for the website. Doing this destroys the config and causes the site to become unmaintainable. You will not be able to maintain this site anymore until you have undone all changes that certbot did in the apache config, if you find any files with '-le' in the apache sites-enabled folder, then you have to remove them all.
     
    helders likes this.
  15. helders

    helders New Member

    Yeah that is correct, i was using certbot on the shell, but when i try to enable from the website it doesn't work, any link where i can check if everything is set ok?

    By the way, i have 2 servers under this setup, on one of them it works but not on the second one.
     
  16. till

    till Super Moderator Staff Member ISPConfig Developer

    helders likes this.
  17. helders

    helders New Member

    till, worked like a charm, i'm removing the -le-ssl files are enabling it on the web interface and now it does show FPM/FastCGI as the Server API, thanks a bunch!
     
    till likes this.
  18. helders

    helders New Member

    One last thing, any tips on how to properly enable fpm status page? I commented out the line on the www.conf file but host/status doesn't work, nor does the /php-fpm-status pages on the hosts i enabled FPM.

    PS: the hosts i want to access the status page do have mod rewrite and .htaccess files
     
    Last edited: Sep 12, 2019 at 5:26 AM
  19. till

    till Super Moderator Staff Member ISPConfig Developer

    I've never used the php-fpm status page.
     

Share This Page