简体   繁体   中英

PHP scripts missing <?php won't run

I've downloaded a module library for Yii in which every PHP file starts with this:

<?

...rather than:

<?php

On my local Apache server, these files get loaded as flat files, rather than as executable scripts, though the files are all modded as writable and executable. Is there a way to force these files to be run as PHP, or do I have to modify all the files (and there are probably a hundred of them).

You will have to enable short_php_tag from php.ini Or better change <? to <?php in your file.

Tells PHP whether the short form () of PHP's open tag should be allowed. If you want to use PHP in combination with XML, you can disable this option in order to use inline. Otherwise, you can print it with PHP, for example: '; ?>'. Also, if disabled, you must use the long form of the PHP open tag ().

You need to activate the

short_open_tag

in the php.ini from "Off" to "On". Dont forget to reload/restart the apache

您可以添加带有以下行的.htaccess文件以使其工作:php_value short_tags on

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