• If you are still using CentOS 7.9, it's time to convert to Alma 8 with the free centos2alma tool by Plesk or Plesk Migrator. Please let us know your experiences or concerns in this thread:
    CentOS2Alma discussion
  • Inviting everyone to the UX test of a new security feature in the WP Toolkit
    For WordPress site owners, threats posed by hackers are ever-present. Because of this, we are developing a new security feature for the WP Toolkit. If the topic of WordPress website security is relevant to you, we would be grateful if you could share your experience and help us test the usability of this feature. We invite you to join us for a 1-hour online session via Google Meet. Select a convenient meeting time with our friendly UX staff here.

can't parse php in .html files

S

skepticwebguy

Guest
I've recently moved from a MediaTemple (dv) 3.5 to a (dv) 4.0. I am now running Plesk 10.4.4.

When I configure PHP Settings to "run as FastCGI application" rather than as an "Apache module" my server will not parse php within html files. Viewing source of the blank page reveals the unparsed php. No errors occur in the log.

Setting PHP to run as an Apache module will parse php in html files as long as I have this line in my .htaccess file:

AddHandler php5-script .php .html


I've tried adding the following groups of lines (at various times) to my .htaccess file, but php still won't parse in FastCGI mode:

AddType x-httpd-php .php .htm .htm

addtype application/x-httpd-php .html

<FilesMatch "\.(htm|html|php)$">
SetHandler application/x-httpd-php
</FilesMatch>

AddType application/x-httpd-php php html

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

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

I have NOT tried modifying apache.httpd.conf yet.

Suggestions?
 
Did you try

/usr/local/psa/admin/sbin/httpdmng with options --reconfigure-all or --reconfigure-server ?
 
Did you try

/usr/local/psa/admin/sbin/httpdmng with options --reconfigure-all or --reconfigure-server ?

I haven't tried either of those commands.

What does --reconfigure-all do exactly? I don't want to mess up the other domains that are working (that don't have php in html files). I could change all the html files to php extensions, but I'd have a mess of redirects and dead site links if I did that. Google would not be happy with all the old dead links to .html files.

What about --reconfigure-domain <domain.com> ? At least that wouldn't affect the other domains on the server.
 
I changed php settings to 'fastcgi application' from 'apache module' and saved.

I ran:

/usr/local/psa/admin/sbin/httpdmng --reconfigure-all
/etc/init.d/httpd restart

No change. php on .html pages still won't parse with this line in my .htaccess file:

AddHandler php5-script .php .htm .html .inc
 
What about parsing without your custom .htaccess file?
 
Simply adding this line to my .htaccess file did the trick:

AddHandler php-script .html
 
Now, I need a solution to parse php in .inc files as well. And this doesn't work:

AddHandler php-script .inc
 
hi

i have tried all things in this post... still can,t get parse php in html file..

I am using Amazon.com hosting.. Please find me a problem..

Thanks..
 
Back
Top