本文翻譯自: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覆蓋了它