0

I have a server with suPHP, Apache2 and PHP5.4.

I noticed that a document index.html will execute PHP code, while test.html will not execute PHP code. Of course I do not want that PHP code is executed inside a index.html file.

I do not know where I should look to find the problem. I didn't find a spot in my configuration where I assign the php-handler to some non-*.php-files.

Here is my mods-available/suphp.conf

<IfModule mod_suphp.c>
        <FilesMatch "\.ph(p3?|tml)$">
                SetHandler application/x-httpd-suphp
        </FilesMatch>
        suPHP_AddHandler application/x-httpd-suphp

#       suPHP_PHPPath /usr/bin/php
        <FilesMatch "\.phps$">
                SetHandler application/x-httpd-php-source
#               Order allow,deny
#               Allow from all
        </FilesMatch>
        AddType application/x-httpd-php-source .phps
        suPHP_AddHandler application/x-httpd-php-source
#       AddHandler application/x-httpd-php-source

        <Directory />
                suPHP_Engine on
        </Directory>

    # By default, disable suPHP for debian packaged web applications as files
    # are owned by root and cannot be executed by suPHP because of min_uid.
# Benötigen wir für Nagios3
#       <Directory /usr/share>
#               suPHP_Engine off
#       </Directory>

# # Use a specific php config file (a dir which contains a php.ini file)
#       suPHP_ConfigPath /etc/php5/cgi/suphp/
# # Tells mod_suphp NOT to handle requests with the type <mime-type>.
#       suPHP_RemoveHandler <mime-type>
</IfModule>

Here is my mods-available/php5.conf

<IfModule mod_php5.c>
    <FilesMatch "\.ph(p3?|tml)$">
        SetHandler application/x-httpd-php
    </FilesMatch>
    <FilesMatch "\.phps$">
        SetHandler application/x-httpd-php-source
    </FilesMatch>
    # To re-enable php in user directories comment the following lines
    # (from <IfModule ...> to </IfModule>.) Do NOT set it to On as it
    # prevents .htaccess files from disabling it.
#    <IfModule mod_userdir.c>
#        <Directory /home/*/public_html>
#            php_admin_value engine Off
#        </Directory>
#    </IfModule>
</IfModule>
Daniel Marschall
  • 803
  • 4
  • 9
  • 20

2 Answers2

1

Check your .htaccess files for the following, as you could have php interpretation turned on there:

AddType application/x-httpd-php .html .htm

If that doesn't work, do a string search. It more than likely is turned on somewhere.

grep -rnw 'web_directory_here' -e "x-httpd-php"

If you find the AddType anywhere, remove it.

==

UPDATE: Another place to check is your apache MIME types to make sure that html isn't being set to php. Make sure html isn't on either of the lines below.

check in httpd/conf 
application/x-httpd-php phtml php php3 php4 php5 php6
application/x-httpd-php-source  phps
0

You quote your mods-available/php5.conf. Is your mod_php5 enabled, that is do you have a /etc/apache2/mods-enabled/php5.load? If so, try a2dismod php5, as it isn't recommended to have both suphp and mod_php enabled at the same time, at least not globally. Also try a phpinfo() in your index.html to work out which module is handling the request..

Cedric Knight
  • 1,108
  • 7
  • 20