If just the index.php loads as its generic unparsed self, what exactly is [not] happening?
I visited a client's site today, and I'm getting the actual content of their index.php file itself rather than their website. The function of the index.php file say开发者_C百科s:
This file loads and executes the parser. *
Assuming this is not happening, what would be some common reasons for that?
If the apache and php are configured correctly, so that .php files go through the php interpreter, the thing I would check is whether the php files are using short open tags "<?" instead of standard "<?php" open tags. By default newer php versions are configured to not accept short tags as this feature is deprecated now. If this is the case, look for "short_open_tag" line in php.ini and set it to "on" or, preferrably and if time allows, change the tags in the code. Although the second option is better in the long run, it can be time consumming and error-prone if done manually.
I have done such a thing in the past with a site-wide find/replace operation and the general way is this.
- Find all "<?=" and replace with "~|~|~|~|" or some other unusual string that is extremely unlikely to turn up in real code.
- Find all "<?php" and replace with "$#$#$#"
- Find all "<?" in the site and replace with "$#$#$#"
- Find all "$#$#$#" and replace with "<?php " The trailing space is advised
- Find all "~|~|~|~|" and replace with "<?php echo " The trailing space is neccessary
精彩评论