Render HTML through PHP


2016-11-16 13:17:35 UTC


2017-08-08 13:38:33 UTC


Was this article helpful?

Have more questions?

Submit a request

Render HTML through PHP

Applicable to:

  • Plesk 12.5 for Linux


How to process files with .html extension through PHP (Linux)


To process HTML pages through PHP, it is important to first determine which mode PHP is running in, and specifically, whether it is running through the Apache module as a CGI or FastCGI application. This can be done by looking at the hosting settings of the domain by clicking on the domain name on the Websites & Domains tab in the control panel.

Next, choose one of following sections, depending on the PHP execution mode, and put it in the conf/vhost.conf file in the virtual host directory. Then reconfigure the web server using this command:

/usr/local/psa/admin/sbin/httpdmng --reconfigure-all

PHP is running as an Apache module:

<IfModule mod_php5.c>
AddHandler php5-script .php .html .htm
AddType text/html .php .html .htm

PHP is running as a FastCGI application:

<IfModule mod_fcgid.c>
<Files ~ (\\.html)>
SetHandler fcgid-script
FCGIWrapper /var/www/cgi-bin/cgi_wrapper/cgi_wrapper .html
Options +ExecCGI
allow from all

PHP is running as a CGI application:

<Files ~ (\\.html)>
SetHandler None
AddHandler php-script .html
Options +ExecCGI
allow from all

If a change is required on a global scale, then the virtual host configuration templates can be adjusted and the sections above put into web server configuration files automatically. For more information, check KB article #115277.

Instructions for processing HTML files by PHP for Plesk for Windows are available in KB article #115774.

Have more questions? Submit a request
Please sign in to leave a comment.