本文翻译自:How to enable PHP short tags?
I have a web application on a Linux server which starts with <?
我在Linux服务器上有一个以<?
开头的Web应用程序<?
I needed to copy this application to a windows environment and everything is working fine except that an SQL statement is being rendered differently. 我需要将此应用程序复制到Windows环境,并且一切工作正常,除了SQL语句的呈现方式有所不同。 I don't know if this has to do with the script beginning with <?php
instead of <?
我不知道这是否与以<?php
而不是<?
开头的脚本有关 because I don't know from where to enable the <?
因为我不知道从何处启用<?
from the PHP.ini
so I changed it to <?php
从PHP.ini
所以我将其更改为<?php
I know that these 2 statements are supposed to mean the same but I need to test it with <?
我知道这两个语句应该具有相同的含义,但是我需要用<?
in order to ensure that the application is exactly the same. 为了确保应用程序完全相同。 This way I can eliminate another possibility. 这样我可以消除另一种可能性。
Thanks 谢谢
#1楼
参考:https://stackoom.com/question/9AV6/如何启用PHP短标签
#2楼
For Wamp Server users there is easier way: You may enable that setting simply (left) click once on the WampServer icon, choose PHP -> PHP settings -> short open tag. 对于Wamp Server用户,有一种更简单的方法:您可以简单地(左)在WampServer图标上单击一次启用该设置,然后选择PHP-> PHP settings-> short open tag。 Wait for a second, then WampServer will automatically restart your PHP and also its web service. 请稍等,然后WampServer将自动重新启动PHP及其Web服务。
originally from: http://osticket.com/forums/showthread.php?t=3149 最初来自: http : //osticket.com/forums/showthread.php?t=3149
#3楼
As simple, as that, follow the following steps: 如此简单,请执行以下步骤:
- go to php.ini file 转到php.ini文件
- find, 'short_open_tag' and set it to on, 找到“ short_open_tag”并将其设置为on,
- restart the server 重新启动服务器
so, short_open_tag = On 因此,short_open_tag =开
#4楼
This can be done by enabling short_open_tag in php.ini: 这可以通过在php.ini中启用short_open_tag来完成:
1.To locate php.ini file,on comment line execute 1.找到php.ini文件,在注释行执行
php --ini
you will get some thing like this, 你会得到这样的东西,
Configuration File (php.ini) Path: /etc
Loaded Configuration File: /etc/php.ini
Scan for additional .ini files in: /etc/php.d
Additional .ini files parsed: /etc/php.d/curl.ini,
/etc/php.d/fileinfo.ini,
/etc/php.d/gd.ini,
/etc/php.d/json.ini,
/etc/php.d/mcrypt.ini,
/etc/php.d/mysql.ini,
/etc/php.d/mysqli.ini,
/etc/php.d/pdo.ini,
/etc/php.d/pdo_mysql.ini,
/etc/php.d/pdo_sqlite.ini,
/etc/php.d/phar.ini,
/etc/php.d/sqlite3.ini,
/etc/php.d/zip.ini
See 2nd line from the comment output.The file will be in the mentioned path. 请参阅注释输出的第二行。文件将在上述路径中。
2.Open php.ini file and find short_open_tag
. 2.打开php.ini文件并找到short_open_tag
。 By default it is in off
change it to on
. 默认情况下,它处于off
将其更改为on
。
3.Restart the server,execute this comment 3.重新启动服务器,执行此注释
service httpd restart
Thanks 谢谢
#5楼
In CentOS 6(tested on Centos 7 too) you can't set short_open_tag in /etc/php.ini for php-fpm. 在CentOS 6中(也已在Centos 7上进行了测试),您不能在/etc/php.ini中为php-fpm设置short_open_tag。 You will have error: 您将遇到错误:
ERROR: [/etc/php.ini:159] unknown entry 'short_open_tag'
ERROR: Unable to include /etc/php.ini from /etc/php-fpm.conf at line 159
ERROR: failed to load configuration file '/etc/php-fpm.conf'
ERROR: FPM initialization failed
You must edit config for your site, which can found in /etc/php-fpm.d/www.conf And write at end of file: 您必须为您的站点编辑配置,该配置可以在/etc/php-fpm.d/www.conf中找到,并在文件末尾写入:
php_value[short_open_tag] = On
#6楼
if using xampp, you will notice the php.ini file has twice mentioned short_open_tag . 如果使用xampp,您会注意到php.ini文件两次提到了short_open_tag。 Enable the second one to short_open_tag = On . 启用第二个到short_open_tag = On。 The first one is commented out and you might be tempted to uncomment and edit it but it is over-ridden by a second short_open_tag 第一个已被注释掉,您可能会想取消注释并对其进行编辑,但是第二个short_open_tag覆盖了它