php code is downloaded after update to 3.1

Discussion in 'ISPConfig 3 Priority Support' started by chico11mbit, Sep 27, 2016.

  1. chico11mbit

    chico11mbit Member

    Hi,
    after upgrade to ispconfig 3.1 all php files in sites with PHP-FPM enabled are downloaded and not executed.
    Also on a new fresh website with php-fpm enabled and "info.php" the "info.php" is downloaded to the client and not executed.
    there is no problem, when i switch the site to fast-cgi. Fresh and old sites are running flawlessly then.

    Here is the fresh apache vhost file which was created from ispconfig 3.1:

    Code:
    <Directory /var/www/MYDOMAIN.COM>
                    AllowOverride None
                                    Require all denied
                    </Directory>
    
    <VirtualHost *:80>
    
                                            DocumentRoot /var/www/clients/client1/web73/web
    
                    ServerName MYDOMAIN.COM
                    ServerAlias www.MYDOMAIN.COM
                    ServerAdmin [email protected]
    
                    ErrorLog /var/log/ispconfig/httpd/MYDOMAIN.COM/error.log
    
                    Alias /error/ "/var/www/MYDOMAIN.COM/web/error/"
                    ErrorDocument 400 /error/400.html
                    ErrorDocument 401 /error/401.html
                    ErrorDocument 403 /error/403.html
                    ErrorDocument 404 /error/404.html
                    ErrorDocument 405 /error/405.html
                    ErrorDocument 500 /error/500.html
                    ErrorDocument 502 /error/502.html
                    ErrorDocument 503 /error/503.html
    
                    <IfModule mod_ssl.c>
                    </IfModule>
    
                    <Directory /var/www/MYDOMAIN.COM/web>
                                    # Clear PHP settings of this website
                                    <FilesMatch ".+\.ph(p[345]?|t|tml)$">
                                                    SetHandler None
                                    </FilesMatch>
                                    Options +FollowSymLinks
                                    AllowOverride All
                                                                    Require all granted
    
                                    # ssi enabled
                                    AddType text/html .shtml
                                    AddOutputFilter INCLUDES .shtml
                                    Options +Includes
                    </Directory>
                    <Directory /var/www/clients/client1/web73/web>
                                    # Clear PHP settings of this website
                                    <FilesMatch ".+\.ph(p[345]?|t|tml)$">
                                                    SetHandler None
                                    </FilesMatch>
                                    Options +FollowSymLinks
                                    AllowOverride All
                                                                    Require all granted
    
                                    # ssi enabled
                                    AddType text/html .shtml
                                    AddOutputFilter INCLUDES .shtml
                                    Options +Includes
                    </Directory>
    
                    <IfModule mod_ruby.c>
                            <Directory /var/www/MYDOMAIN.COM/web>
                                    Options +ExecCGI
                            </Directory>
                            RubyRequire apache/ruby-run
                            #RubySafeLevel 0
                            AddType text/html .rb
                            AddType text/html .rbx
                            <Files *.rb>
                                    SetHandler ruby-object
                                    RubyHandler Apache::RubyRun.instance
                            </Files>
                            <Files *.rbx>
                                    SetHandler ruby-object
                                    RubyHandler Apache::RubyRun.instance
                            </Files>
                    </IfModule>
    
                    <IfModule mod_perl.c>
                            PerlModule ModPerl::Registry
                            PerlModule Apache2::Reload
                            <Directory /var/www/MYDOMAIN.COM/web>
                                    PerlResponseHandler ModPerl::Registry
                                    PerlOptions +ParseHeaders
                                    Options +ExecCGI
                            </Directory>
                            <Directory /var/www/clients/client1/web73/web>
                                    PerlResponseHandler ModPerl::Registry
                                    PerlOptions +ParseHeaders
                                    Options +ExecCGI
                            </Directory>
                <Files *.pl>
                                    SetHandler perl-script
                </Files>
                    </IfModule>
    
                    <IfModule mod_python.c>
                            <Directory /var/www/MYDOMAIN.COM/web>
                                    <FilesMatch "\.py$">
                                            SetHandler mod_python
                                    </FilesMatch>
                                    PythonHandler mod_python.publisher
                                    PythonDebug On
                            </Directory>
                    </IfModule>
    
                    # cgi enabled
            <Directory /var/www/clients/client1/web73/cgi-bin>
                                                    Require all granted
                                            </Directory>
                    ScriptAlias  /cgi-bin/ /var/www/clients/client1/web73/cgi-bin/
                    <FilesMatch "\.(cgi|pl)$">
                            SetHandler cgi-script
                    </FilesMatch>
                    # suexec enabled
                    <IfModule mod_suexec.c>
                            SuexecUserGroup web73 client1
                    </IfModule>
                    <IfModule mod_fastcgi.c>
                                    <Directory /var/www/clients/client1/web73/cgi-bin>
                                                                                    Require all granted
                                                                        </Directory>
                                    <Directory /var/www/MYDOMAIN.COM/web>
                                            <FilesMatch "\.php[345]?$">
                                                    SetHandler php5-fcgi
                                            </FilesMatch>
                                    </Directory>
                                    <Directory /var/www/clients/client1/web73/web>
                                            <FilesMatch "\.php[345]?$">
                                                    SetHandler php5-fcgi
                                            </FilesMatch>
                                    </Directory>
                    Action php5-fcgi /php5-fcgi virtual
                                    Alias /php5-fcgi /var/www/clients/client1/web73/cgi-bin/php5-fcgi-*-80-MYDOMAIN.COM
                    FastCgiExternalServer /var/www/clients/client1/web73/cgi-bin/php5-fcgi-*-80-MYDOMAIN.COM -idle-timeout 300 -host 127.0.0.1:9082 -pass-header Authorization
                    </IfModule>
                    <IfModule mod_proxy_fcgi.c>
                            #ProxyPassMatch ^/(.*\.php[345]?(/.*)?)$ fcgi://127.0.0.1:9082/var/www/clients/client1/web73/web/$1
                            <Directory /var/www/clients/client1/web73/web>
                                    <FilesMatch "\.php[345]?$">
                                                    SetHandler "proxy:fcgi://127.0.0.1:9082"
                                    </FilesMatch>
                            </Directory>
                            </IfModule>
    
    
    
                    # add support for apache mpm_itk
                    <IfModule mpm_itk_module>
                            AssignUserId web73 client1
                    </IfModule>
    
                    <IfModule mod_dav_fs.c>
                    # Do not execute PHP files in webdav directory
                            <Directory /var/www/clients/client1/web73/webdav>
                                    <ifModule mod_security2.c>
                                            SecRuleRemoveById 960015
                                            SecRuleRemoveById 960032
                                    </ifModule>
                                    <FilesMatch "\.ph(p3?|tml)$">
                                            SetHandler None
                                    </FilesMatch>
                            </Directory>
                            DavLockDB /var/www/clients/client1/web73/tmp/DavLock
                            # DO NOT REMOVE THE COMMENTS!
                            # IF YOU REMOVE THEM, WEBDAV WILL NOT WORK ANYMORE!
          # WEBDAV BEGIN
                            # WEBDAV END
                    </IfModule>
    
    
    
    </VirtualHost>
    
     
  2. till

    till Super Moderator Staff Member ISPConfig Developer

    The update does not alter any vhosts of websites or their php configiration, so existing sites should not be affected. If they are affected, then the reason for the problem might be related to other software installations or changes made before the ispconfig update.

    Which OS do you use?
     
  3. chico11mbit

    chico11mbit Member

    ubuntu 14.04LTS.
    It occured when i resynced the websites in the tools menu. Before all was good after the upgrade.
    additional info: it happens with the standard php-fpm frpm php5.5.9 and also with php-fpm from additional php5.6.10

    php5-fpm -t gives
    root@server:/home# php5-fpm -v
    PHP 5.5.9-1ubuntu4.19 (fpm-fcgi) (built: Jul 28 2016 19:35:43)
    Copyright (c) 1997-2014 The PHP Group
    Zend Engine v2.5.0, Copyright (c) 1998-2014 Zend Technologies
    with XCache v3.1.0, Copyright (c) 2005-2013, by mOo
    with Zend OPcache v7.0.3, Copyright (c) 1999-2014, by Zend Technologies
    with XCache Optimizer v3.1.0, Copyright (c) 2005-2013, by mOo
    with XCache Cacher v3.1.0, Copyright (c) 2005-2013, by mOo
    with XCache Coverager v3.1.0, Copyright (c) 2005-2013, by mOo
     
    Last edited: Sep 27, 2016
  4. chico11mbit

    chico11mbit Member

    Hi,
    i replaced the new generated vhost with the old one from before upgrading and resyncing.
    This one works flawlessly. So my question is, where is the error in my serverconfig?
    I think it is somewhere in <IfModule mod_fastcgi.c>
    Code:
    <Directory /var/www/MYDOMAIN.com>
            AllowOverride None
                    Require all denied
            </Directory>
    
    <VirtualHost *:80>
                        DocumentRoot /var/www/clients/client1/web19/web
              
            ServerName MYDOMAIN.com
            ServerAlias www.MYDOMAIN.com
            ServerAdmin [email protected]
    
            ErrorLog /var/log/ispconfig/httpd/MYDOMAIN.com/error.log
    
            Alias /error/ "/var/www/MYDOMAIN.com/web/error/"
            ErrorDocument 400 /error/400.html
            ErrorDocument 401 /error/401.html
            ErrorDocument 403 /error/403.html
            ErrorDocument 404 /error/404.html
            ErrorDocument 405 /error/405.html
            ErrorDocument 500 /error/500.html
            ErrorDocument 502 /error/502.html
            ErrorDocument 503 /error/503.html
    
            <IfModule mod_ssl.c>
            </IfModule>
    
            <Directory /var/www/MYDOMAIN.com/web>
                    # Clear PHP settings of this website
                    <FilesMatch ".+\.ph(p[345]?|t|tml)$">
                            SetHandler None
                    </FilesMatch>
                    Options +FollowSymLinks
                    AllowOverride All
                                    Require all granted
                  
                    # ssi enabled
                    AddType text/html .shtml
                    AddOutputFilter INCLUDES .shtml
                    Options +Includes
            </Directory>
            <Directory /var/www/clients/client1/web19/web>
                    # Clear PHP settings of this website
                    <FilesMatch ".+\.ph(p[345]?|t|tml)$">
                            SetHandler None
                    </FilesMatch>
                    Options +FollowSymLinks
                    AllowOverride All
                                    Require all granted
                  
                    # ssi enabled
                    AddType text/html .shtml
                    AddOutputFilter INCLUDES .shtml
                    Options +Includes
            </Directory>
    
    
    
    
            # suexec enabled
            <IfModule mod_suexec.c>
                SuexecUserGroup web19 client1
            </IfModule>
            <IfModule mod_fastcgi.c>
                    <Directory /var/www/clients/client1/web19/cgi-bin>
                                            Require all granted
                                       </Directory>
                    <Directory /var/www/MYDOMAIN.com/web>
                        <FilesMatch "\.php[345]?$">
                            SetHandler php5-fcgi
                        </FilesMatch>
                    </Directory>
                    <Directory /var/www/clients/client1/web19/web>
                        <FilesMatch "\.php[345]?$">
                            SetHandler php5-fcgi
                        </FilesMatch>
                    </Directory>
                    Action php5-fcgi /php5-fcgi
                    Alias /php5-fcgi /var/www/clients/client1/web19/cgi-bin/php5-fcgi-*-80-MYDOMAIN.com
                    FastCgiExternalServer /var/www/clients/client1/web19/cgi-bin/php5-fcgi-*-80-MYDOMAIN.com -idle-timeout 300 -host 127.0.0.1:9018 -pass-header Authorization
            </IfModule>
            <IfModule mod_proxy_fcgi.c>
                ProxyPassMatch ^/(.*\.php[345]?(/.*)?)$ fcgi://127.0.0.1:9018/var/www/clients/client1/web19/web/$1
            </IfModule>
    
    
            # add support for apache mpm_itk
            <IfModule mpm_itk_module>
                AssignUserId web19 client1
            </IfModule>
    
            <IfModule mod_dav_fs.c>
            # Do not execute PHP files in webdav directory
                <Directory /var/www/clients/client1/web19/webdav>
                    <ifModule mod_security2.c>
                        SecRuleRemoveById 960015
                        SecRuleRemoveById 960032
                    </ifModule>
                    <FilesMatch "\.ph(p3?|tml)$">
                        SetHandler None
                    </FilesMatch>
                </Directory>
                DavLockDB /var/www/clients/client1/web19/tmp/DavLock
                # DO NOT REMOVE THE COMMENTS!
                # IF YOU REMOVE THEM, WEBDAV WILL NOT WORK ANYMORE!
          # WEBDAV BEGIN
                # WEBDAV END
            </IfModule>
    
    #RewriteEngine On
    #RewriteCond %{HTTPS} off
    #RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI}
    
    
    <IfModule mod_fcgid.c>
    MaxRequestLen 2097152000
    </IfModule>
    <Directory "/var/www/MYDOMAIN.com/web">
    Options -Indexes
    </Directory>
    Loglevel info
    
    </VirtualHost>
    <VirtualHost *:443>
                        DocumentRoot /var/www/clients/client1/web19/web
              
            ServerName MYDOMAIN.com
            ServerAlias www.MYDOMAIN.com
            ServerAdmin [email protected]
    
            ErrorLog /var/log/ispconfig/httpd/MYDOMAIN.com/error.log
    
            Alias /error/ "/var/www/MYDOMAIN.com/web/error/"
            ErrorDocument 400 /error/400.html
            ErrorDocument 401 /error/401.html
            ErrorDocument 403 /error/403.html
            ErrorDocument 404 /error/404.html
            ErrorDocument 405 /error/405.html
            ErrorDocument 500 /error/500.html
            ErrorDocument 502 /error/502.html
            ErrorDocument 503 /error/503.html
    
            <IfModule mod_ssl.c>
            SSLEngine on
            SSLProtocol All -SSLv2 -SSLv3
            SSLCertificateFile /var/www/clients/client1/web19/ssl/www.MYDOMAIN.com.crt
            SSLCertificateKeyFile /var/www/clients/client1/web19/ssl/www.MYDOMAIN.com.key
            SSLCACertificateFile /var/www/clients/client1/web19/ssl/www.MYDOMAIN.com.bundle
            </IfModule>
    
            <Directory /var/www/MYDOMAIN.com/web>
                    # Clear PHP settings of this website
                    <FilesMatch ".+\.ph(p[345]?|t|tml)$">
                            SetHandler None
                    </FilesMatch>
                    Options +FollowSymLinks
                    AllowOverride All
                                    Require all granted
                  
                    # ssi enabled
                    AddType text/html .shtml
                    AddOutputFilter INCLUDES .shtml
                    Options +Includes
            </Directory>
            <Directory /var/www/clients/client1/web19/web>
                    # Clear PHP settings of this website
                    <FilesMatch ".+\.ph(p[345]?|t|tml)$">
                            SetHandler None
                    </FilesMatch>
                    Options +FollowSymLinks
                    AllowOverride All
                                    Require all granted
                  
                    # ssi enabled
                    AddType text/html .shtml
                    AddOutputFilter INCLUDES .shtml
                    Options +Includes
            </Directory>
    
    
    
    
            # suexec enabled
            <IfModule mod_suexec.c>
                SuexecUserGroup web19 client1
            </IfModule>
            <IfModule mod_fastcgi.c>
                    <Directory /var/www/clients/client1/web19/cgi-bin>
                                            Require all granted
                                       </Directory>
                    <Directory /var/www/MYDOMAIN.com/web>
                        <FilesMatch "\.php[345]?$">
                            SetHandler php5-fcgi
                        </FilesMatch>
                    </Directory>
                    <Directory /var/www/clients/client1/web19/web>
                        <FilesMatch "\.php[345]?$">
                            SetHandler php5-fcgi
                        </FilesMatch>
                    </Directory>
                    Action php5-fcgi /php5-fcgi
                    Alias /php5-fcgi /var/www/clients/client1/web19/cgi-bin/php5-fcgi-*-443-MYDOMAIN.com
                    FastCgiExternalServer /var/www/clients/client1/web19/cgi-bin/php5-fcgi-*-443-MYDOMAIN.com -idle-timeout 300 -host 127.0.0.1:9018 -pass-header Authorization
            </IfModule>
            <IfModule mod_proxy_fcgi.c>
                ProxyPassMatch ^/(.*\.php[345]?(/.*)?)$ fcgi://127.0.0.1:9018/var/www/clients/client1/web19/web/$1
            </IfModule>
    
    
            # add support for apache mpm_itk
            <IfModule mpm_itk_module>
                AssignUserId web19 client1
            </IfModule>
    
            <IfModule mod_dav_fs.c>
            # Do not execute PHP files in webdav directory
                <Directory /var/www/clients/client1/web19/webdav>
                    <ifModule mod_security2.c>
                        SecRuleRemoveById 960015
                        SecRuleRemoveById 960032
                    </ifModule>
                    <FilesMatch "\.ph(p3?|tml)$">
                        SetHandler None
                    </FilesMatch>
                </Directory>
                DavLockDB /var/www/clients/client1/web19/tmp/DavLock
                # DO NOT REMOVE THE COMMENTS!
                # IF YOU REMOVE THEM, WEBDAV WILL NOT WORK ANYMORE!
          # WEBDAV BEGIN
                # WEBDAV END
            </IfModule>
    
    #RewriteEngine On
    #RewriteCond %{HTTPS} off
    #RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI}
    
    
    <IfModule mod_fcgid.c>
    MaxRequestLen 2097152000
    </IfModule>
    <Directory "/var/www/MYDOMAIN.com/web">
    Options -Indexes
    </Directory>
    Loglevel info
    
    </VirtualHost>
    
    
     
  5. till

    till Super Moderator Staff Member ISPConfig Developer

    Please check that mod_fastcgi is loaded and installed on the server.
    Then try to comment out the line

    ProxyPassMatch ....

    and restart apache and check if this vhost works then.
     
  6. chico11mbit

    chico11mbit Member

    success. after removing the # before ProxyPassMatch the php-site is running.
    When ssl is enabled i have to change two places where this line is.

    so my question: how can i activate that from within ispconfig 3.1?

    cheers
    Chico
     
    Last edited: Sep 28, 2016
  7. till

    till Super Moderator Staff Member ISPConfig Developer

    You mean you added the # before the line as I suggested? Because in your file above, there is no # before ProxyPass.
     
  8. chico11mbit

    chico11mbit Member

    sorry,
    the second config was the old config from ispconfig 3.0.5 which works.
    the First config (1st message here) is the One created by ISPconfig 3.1 which is not running.
    in the first it is commented out, in the second it is not commented out.
     
  9. till

    till Super Moderator Staff Member ISPConfig Developer

    Hmm, ok. The problem seems to be that mod_proxy_fcgi in Ubuntu 14.04 does not support the new syntax "
    SetHandler "proxy:fcgi://127.0.0.1:9082"" which is required for Ubuntu 16.04.

    Please do this:

    cp /usr/local/ispconfig/server/conf/vhost.conf.master /usr/local/ispconfig/server/conf-custom/vhost.conf.master

    Then edit the file /usr/local/ispconfig/server/conf-custom/vhost.conf.master and remove the # in front of the
    ProxyPassMatch line.
     
  10. chico11mbit

    chico11mbit Member

    do you think it is better to do a release upgrade to 16.04.1LTS?
     
  11. till

    till Super Moderator Staff Member ISPConfig Developer

    I would stay at 14.04 for now if you don't have other reasons for an upgrade. Ubuntu 16.04 has a lot of new software and it is possible that you get a lot of other problems (not ispconfig related) due to the new versions of php etc. then.
     
  12. chico11mbit

    chico11mbit Member

    hmm, i thought the problem is fixed in the template file after update to ispconfig 3.1.1. But it seems it is not ;)
     
  13. till

    till Super Moderator Staff Member ISPConfig Developer

    If we would do the change that you propose then we would disable PHP in newer Ubuntu releases. I posted in #9 what you have to do to fix it and make the change update safe n your system.
     
  14. chico11mbit

    chico11mbit Member

    Ah ok,
    i thought that it would be possible to detect older or newer releases inside ispconfig's mechanisms.... I changed it manually after update and it runs flawlessly. It was very helpful that it is mentioned in the update informations. Thx...
     

Share This Page