phpapachesslcentossuphp

Php commented out on ssl only


I have centos 7 running php 5, and two vhosts.

One vhost works perfectly, rendering php as expected and everything is working. The other vhost is not.

The problem is that php code is commenting out in one of them, although the file is .php NOT html.

Both have same configuration as I copied/pasted everything when first created them, here it is:

<Directory "/var/www/html/XX/public_html/">
                DirectoryIndex index.html index.php
                Options FollowSymLinks
                AllowOverride All
                Require all granted
        </Directory>
        <FilesMatch ".+\.ph(p[345]?|t|tml)$">
                SetHandler None
        </FilesMatch>

         <IfModule mod_suphp.c>
                suPHP_Engine on
                <FilesMatch "\.php[345]?$">
                        SetHandler x-httpd-suphp
                </FilesMatch>
                suPHP_AddHandler x-httpd-suphp
        </IfModule>

I have checked SELINUX, it is disabled.

The only different is that the vhost which commenting php codes has a SSL certificate installed.

if you need more information to sort this problem, tell me.

Thanks in advance.

EDIT:

By Commented out, I mean:

<?php echo "something"; ?>

becomes:

<--!?php echo "something"; ?-->

when I view page source in the browser.


Solution

  • I don't know how, but adding this line to the php.conf (maybe httpd.conf for you), fixed the issue:

    suPHP_Engine on
    <FilesMatch ".+\.ph(p[345]?|t|tml)$">
            suPHP_AddHandler x-httpd-suphp
            SetHandler x-httpd-suphp
    </FilesMatch>
    

    As I said, the problem was for one virtualhost which has a SSL. Maybe the problem is in the virtualhost inside ssl.conf.