Forum Moderators: coopster

Message Too Old, No Replies

How to get PHP to work on .html pages with SUPHP installed?

Can't use .htaccess, need to use php.ini?

         

brizad

7:47 pm on Jul 14, 2010 (gmt 0)

10+ Year Member Top Contributors Of The Month



I've searched high and low for this and support doesn't have an answer for me.

I just added suphp to my VPS (apache 2.2, php5) and have now found that with suphp, you can't use .htaccess files to set php flags or parameters. This is what I had in my .htaccess files:

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

Support suggested that I could do it with php.ini but I've tried adding that code and various other things that I've found on the net but it's not working.

How can I get php parsed on all .html pages server-wide since I can't use .htaccess?

Thanks!

SevenCubed

8:28 pm on Jul 14, 2010 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



You say this is a VPS -- so I'm guessing you have root access? If yes, depending on your setup you should be able to add...

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

...into...

/etc/apache2/apache2.conf (preferred)

OR

/etc/apache2/httpd.conf (if apache2.conf contains "Include /etc/apache2/httpd.conf")
...and of course reboot apache.

OR

/var/www/vhosts/example.com/conf/vhost.conf (in a Plesk environment)
If the above vhost.conf file doesn't exist simply create it through your control panel and then run this as root user from an ssh terminal:
/usr/local/psa/admin/bin/websrvmng -a (only for Plesk environment, no need to reboot)

...instead of putting it in the .htaccess file. Note that all these options are for a Plesk control panel environment. Yours may be slightly different depending on distribution.

brizad

9:13 pm on Jul 14, 2010 (gmt 0)

10+ Year Member Top Contributors Of The Month



Thanks SevenCubed for your reply.

The server support guys came back and corrected what they told me about not being able to use that code in htaccess. They said I had to use:

AddType application/x-httpd-php5 .html

which has worked. So I guess I don't need to do this server-wide after all. I just added this new code to the htaccess files of the sites that needed it.