Switch from fcgid to fastcgi

Discussion in 'ISPConfig 3 Priority Support' started by medo, Dec 22, 2015.

  1. medo

    medo New Member HowtoForge Supporter

    Hi all,
    I am struggling for how to switch from my centos 64/httpd+fcgid to httpd+fastcgi+php-fpm.
    T have tried to :
    • Disable mod_fcgid module
    • Enable mod_fastcgi module
    • Change ispconfig website from FastCGI to PHP-FPM
    The problem is that httpd won't restart because he does not recognize FCGIWrapper command :
    Invalid command 'FCGIWrapper', perhaps misspelled or defined by a module not included in the server configuration

    What am I doing wrong ?

    Thanks a lot.
     
  2. till

    till Super Moderator Staff Member ISPConfig Developer

  3. medo

    medo New Member HowtoForge Supporter

    Thanks for your reply, I have read that document but found nothing about mod_wsgi.

    I have installed the mod_wsgi module on my httpd24/centos6 installation, but when I switch one of my websites to php-fpm, Server API is set to "Apache 2.0 Handler". Something is wrong and I don't understand where.

    Thanks again.
     
  4. till

    till Super Moderator Staff Member ISPConfig Developer

    mod_wsgi is for centos 7 with apache 2.4 only, not centos 6 wiith apache 2.2. You will have to use mod_fastcgi for centos 6. I just googled for the module and you can get it e.g. here: http://pkgs.repoforge.org/mod_fastcgi/

    And ensure that you did not disable the mod_fcgi module, it is required and yor apache will not start without it.
     
  5. medo

    medo New Member HowtoForge Supporter

    I have installed the wsgi module from repository mod_wsgi-3.2-7.el6.x86_64, the installation is ok but php-fpm still does not work.

    I have removed it now and installed the mod_fastcgi (from repository) along with the mod_fcgid.
    Here is Apache start message :

    Apache/2.2.15 (Unix) DAV/2 mod_fastcgi/2.4.6 mod_fcgid/2.3.9 mod_python/3.3.1 Python/2.6.6 mod_ruby/1.3.0 Ruby/1.8.7(2013-06-27) mod_ssl/2.2.15 OpenSSL/1.0.1e-fips

    But the problem is the same, when I switch a website to php-fpm, Server API is set to "Apache 2.0 Handler"

    Thanks.
     
  6. medo

    medo New Member HowtoForge Supporter

    Sorry, I cannot use both mod_fcgid and mod_fastcgi as I get in all my websites :

    The requested URL /php5-fcgi/... was not found on this server

    Any idea ?
     
  7. till

    till Super Moderator Staff Member ISPConfig Developer

    Both modules can and have to be used together, mod_fastcgi is used for php-fpm and mod_fcgi handles php-fcgi in websites and in the ISPConfig interface.

    Please check that mod_fastcgi is enabled and loaded in apache.
     
  8. medo

    medo New Member HowtoForge Supporter

    As soon as I enable these two modules together, all websites (configured with Fast-CGI) go down with

    "The requested URL /php5-fcgi/... was not found on this server".

    Here is the apache message that shows that the two modules were loaded at that time :

    Apache/2.2.15 (Unix) DAV/2 mod_fastcgi/2.4.6 mod_fcgid/2.3.9 mod_python/3.3.1 Python/2.6.6 mod_ruby/1.3.0 Ruby/1.8.7(2013-06-27) mod_ssl/2.2.15 OpenSSL/1.0.1e-fips
     
  9. medo

    medo New Member HowtoForge Supporter

    Here is my /etc/httpd/conf.d/fastcgi.conf :

    # WARNING: this is a kludge:
    ## The User/Group for httpd need to be set before we can load mod_fastcgi,
    ## but /etc/httpd/conf.d/fastcgi.conf on RHEL gets loaded before
    ## /etc/httpd/conf/httpd.conf, so we need to set them here :(
    ## mod_fcgid does not have this bug,
    ## but it does not handle child PHP processes appropriately per
    ## http://serverfault.com/questions/30...s-blocks-all-other-php-requests/305093#305093

    User apache
    Group apache

    LoadModule fastcgi_module modules/mod_fastcgi.so

    # dir for IPC socket files
    FastCgiIpcDir /var/run/mod_fastcgi

    # wrap all fastcgi script calls in suexec
    FastCgiWrapper On

    # global FastCgiConfig can be overridden by FastCgiServer options in vhost config
    FastCgiConfig -idle-timeout 20 -maxClassProcesses 1

    # sample PHP config
    # see /usr/share/doc/mod_fastcgi-2.4.6 for php-wrapper script
    # don't forget to disable mod_php in /etc/httpd/conf.d/php.conf!
    #
    # to enable privilege separation, add a "SuexecUserGroup" directive
    # and chown the php-wrapper script and parent directory accordingly
    # see also http://www.brandonturner.net/blog/2009/07/fastcgi_with_php_opcode_cache/
    #
    #FastCgiServer /var/www/cgi-bin/php-wrapper
    #AddHandler php-fastcgi .php
    #Action php-fastcgi /cgi-bin/php-wrapper
    #AddType application/x-httpd-php .php
    #DirectoryIndex index.php
    #
    #<Location /cgi-bin/php-wrapper>
    # Order Deny,Allow
    # Deny from All
    # Allow from env=REDIRECT_STATUS
    # Options ExecCGI
    # SetHandler fastcgi-script
    #</Location>
     
  10. medo

    medo New Member HowtoForge Supporter

    Got it, as soon as I have commented the line "FastCgiWrapper On" in /etc/httpd/conf.d/fastcgi.conf , it worked.

    Thanks, now when I switch websites to PHP-FPM, Server API is set to "FPM/FastCGI".

    Still have to understand why though.
     
    till likes this.

Share This Page