简体   繁体   中英

PHP Include, PHP Require Once, PHP 5.2 to 5.6

Godaddy was having some issues installing Wordpress onto one of my sites and they suggested I shift over to their new cpanel hosting, rather than the old one. I did that. Suddenly, many of my sites went down.

I started troubleshooting the issue with Godaddy and apparently the site in question was using 5.2 and since the new cpanel didn't support 5.2, certain parts of the code did not get rendered. The specific code was:

<?php include("header.php"); ?>

I changed this to:

<?php require_once('header.php'); ?>

It still didn't work. Going further, the .htaccess file had the following bit of code added to it:

Options +ExecCGI
AddType application/x-httpd-php .php .html
AddHandler x-httpd-php5 .php .html

I honestly don't recall the reason why I added that bit of code, but for some reason I needed it.

Any suggestions would be appreciated to both edit the code within the html page AND to edit the code within the .htaccess.

Thanks in advance.

(SOLVED!)

After troubleshooting this for a significant amount of time, I found dozens of suggestions on what to add to the .htaccess file. There were numerous addhandler or addtypes that were recommended throughout the internet. I found this site:

https://manage.accuwebhosting.com/knowledgebase/2492/Parse-HTML-As-PHP-Using-HTACCESS-File.html

I tried each one down the list and eventually, this is what worked:

`AddHandler fcgid-script .html
FCGIWrapper /usr/local/cpanel/cgi-sys/php5 .html`

I hope this can help someone else.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM