php:“short_open_tag = On”不起作用

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/12579448/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-25 03:51:07  来源:igfitidea点击:

php: "short_open_tag = On" not working

php

提问by marek_lani

I have recently installed Win8 on my computer. Then I instaled wamp 2.2 with php 5.4 and I am unable to make short tag work.

我最近在我的电脑上安装了 Win8。然后我用 php 5.4 安装了 wamp 2.2,但我无法使短标签工作。

I have already put:

我已经把:

"short_open_tag = On"

“short_open_tag = 开”

into the php.ini file and I am sure that apache is loading the right file because the path to "Loaded Configuration File" in phpinfo()is good.

进入 php.ini 文件,我确信 apache 正在加载正确的文件,因为“加载的配置文件”的路径phpinfo()很好。

I would be glad for any piece of advice. Thanks.

我很乐意为您提供任何建议。谢谢。

回答by Lisa

I had the same problem recently after upgrading from PHP 5.3.18to PHP 5.5.9..

我最近从 升级PHP 5.3.18到后遇到了同样的问题PHP 5.5.9.

I realized that for some reason, short_open_tagwas appearing in my php.ini file twice.

我意识到由于某种原因,short_open_tag它在我的 php.ini 文件中出现了两次。

If you did a find to get to that part of your php.inifile, try continuing the find to see if there is another instance.

如果您进行了查找以找到php.ini文件的该部分,请尝试继续查找以查看是否还有其他实例。

回答by Abdel

Set the :

设置:

asp_tags = On and short_open_tag = On 

in both the files \apache\Apache2.2.22\bin\php.ini and \bin\php\php5.4\php.ini and then restart the apache server.

在文件 \apache\Apache2.2.22\bin\php.ini 和 \bin\php\php5.4\php.ini 中,然后重新启动 apache 服务器。

If you don't have access to the php.ini you can try to enable them trough the .htaccess file but it's possible the hosting company disabled this if you are on shared hosting:

如果您无权访问 php.ini,您可以尝试通过 .htaccess 文件启用它们,但如果您使用的是共享主机,托管公司可能会禁用此功能:

php_value short_open_tag 1

Remember to restart your service (apache2, etc) for the edits to php.ini to take effect.

请记住重新启动您的服务(apache2 等)以使对 php.ini 的编辑生效。

回答by Dirk Pennings

Make sure to replace all

确保全部更换

short_open_tag

occurrences within the php.ini file. In my case there were multiple places where it was defined. For me, the wrong setting was located under

php.ini 文件中的事件。就我而言,有多个地方定义了它。对我来说,错误的设置位于

;;;;;;;;;;;;;;;;;;;;
; Language Options ;
;;;;;;;;;;;;;;;;;;;;

回答by Felipe Rabelo Ferreira

Change the value of short_open_tagto On.

将 的值更改short_open_tagOn

And if your php.inifile is located in /etc/php/5.6/fpmyou need to restart the php5.6-fpmservice with

如果您的php.ini文件位于中/etc/php/5.6/fpm,则需要使用以下命令重新启动php5.6-fpm服务

sudo service php5.6-fpm restart