0

I have 2 linode servers each hosting a website. Site A runs under Ubuntu 14.04/Apache2/Mysql/PHP 5.59, Site B runs under Ubuntu 16.04/Apache2/Mysql/PHP 7.0, and I am using Webmin/Virtualmin to manage them. Recently I tried to install PHP7.2 on site B, there were some problems during the installation but I think I eventually overcome them, only to find out when I open my site, index.php got downloaded instead of parsed by Apache. Through some digging, I found out the apache configuration of site B is like

AddType application/x-httpd-php .php
AddHandler fcgid-script .php
AddHandler fcgid-script .php5.6
AddHandler fcgid-script .php7.0
AddHandler fcgid-script .php7.2
FCGIWrapper /home/tv/fcgi-bin/php5.6.fcgi .php5.6
FCGIWrapper /home/tv/fcgi-bin/php7.0.fcgi .php7.0
FCGIWrapper /home/tv/fcgi-bin/php7.2.fcgi .php7.2
FCGIWrapper /home/tv/fcgi-bin/php7.2.fcgi .php
</Directory>
<Directory /home/tv/cgi-bin>
allow from all
AllowOverride All Options=ExecCGI,Includes,IncludesNOEXEC,Indexes,MultiViews,SymLinksIfOwnerMatch
Require all granted
</Directory>
RewriteEngine on
RewriteCond %{HTTP_HOST} =webmail.peaceevertvimg.org
RewriteRule ^(.*) https://peaceevertvimg.org:20000/ [R]
RewriteCond %{HTTP_HOST} =admin.peaceevertvimg.org
RewriteRule ^(.*) https://peaceevertvimg.org:10000/ [R]
RemoveHandler .php
RemoveHandler .php5.6
RemoveHandler .php7.0
RemoveHandler .php7.2
php_admin_value engine Off

I had to comment out

#RemoveHandler .php
#php_admin_value engine 

to get site B working. I was wondering why virtualmin would automatically add these directives which cause the website to malfunction, while I realized actually these directives also exists for site A. However, site A is running perfectly. Here is site A's corresponding directives

AddType application/x-httpd-php .php
AddHandler fcgid-script .php
AddHandler fcgid-script .php5
FCGIWrapper /home/w/fcgi-bin/php5.fcgi .php
FCGIWrapper /home/w/fcgi-bin/php5.fcgi .php5
</Directory>
<Directory /home/w/cgi-bin>
allow from all
AllowOverride All Options=ExecCGI,Includes,IncludesNOEXEC,Indexes,MultiViews,SymLinksIfOwnerMatch
Require all granted
</Directory>
RewriteEngine on
RewriteCond %{HTTP_HOST} =webmail.weiwei-tv.com
RewriteRule ^(.*) https://weiwei-tv.com:20000/ [R]
RewriteCond %{HTTP_HOST} =admin.weiwei-tv.com
RewriteRule ^(.*) https://weiwei-tv.com:1911/ [R]
RemoveHandler .php
RemoveHandler .php5
php_admin_value engine Off

Both of the sites run PHP under FastCGI mode. So why does "RemoveHandler .php" cause problem on Site B(PHP7.2) while it doesn't on Site A(PHP5.59)?

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Browse other questions tagged or ask your own question.