简体   繁体   English

PHP脚本丢失

[英]PHP scripts missing <?php won't run

I've downloaded a module library for Yii in which every PHP file starts with this: 我已经下载了Yii的模块库,其中每个PHP文件都以此开头:

<?

...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. 在我的本地Apache服务器上,这些文件被加载为平面文件,而不是可执行脚本,尽管这些文件都被修改为可写和可执行。 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). 有没有一种方法可以强制将这些文件作为PHP运行,或者我必须修改所有文件(可能有一百个)。

You will have to enable short_php_tag from php.ini Or better change <? 您将必须从php.ini中启用short_php_tag或更佳的更改<? to <?php in your file. <?php文件中。

Tells PHP whether the short form () of PHP's open tag should be allowed. 告诉PHP是否应允许PHP的open标签的缩写形式()。 If you want to use PHP in combination with XML, you can disable this option in order to use inline. 如果要结合使用PHP和XML,可以禁用此选项以使用内联。 Otherwise, you can print it with PHP, for example: '; 否则,您可以使用PHP打印它,例如:'; ?>'. ?>'。 Also, if disabled, you must use the long form of the PHP open tag (). 另外,如果禁用,则必须使用PHP open标签的长格式()。

You need to activate the 您需要激活

short_open_tag

in the php.ini from "Off" to "On". 在php.ini中,从“关闭”到“打开”。 Dont forget to reload/restart the apache 不要忘记重新加载/重新启动Apache

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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