I am using WAMPP for PHP server and in programming short tag use create a problem. I knew that it possible by change something in php.ini file but I don't know the setting fo开发者_Python百科r that please help me for that.
example:
<? echo "hi"; ?> //error....want to allow this also.
<?php echo "hi"; ?> //ok
I found this in PHP config setting file but what changes require I don't know...
; short_open_tag
; Default Value: On
; Development Value: Off
; Production Value: Off
In your php.ini change the short_open_tag = Off
if it's there to this:
short_open_tag = On
Click on your wamp icon then "PHP". Then click on "PHP Settings". There should be an option for "short open tag" which you should enable by clicking on it, it should show a check mark. Your wamp server will automatically restart in a few seconds and then short open tag will be enabled.
For non-wamp you need to go to your php.ini file and uncomment short_open_tag = On
set short_open_tag = 1
in your php.ini file.
sed -i 's/short_open_tag = Off/short_open_tag = On/g' /etc/php.ini
grep -n short_open_tag php.ini
first line does inlien replace of php.ini to turn on short tags second makes sure its there
Sometime setting short_open_tag = On
on your php.ini will not work because in some cases, short_open_tag
define more than one. So find all short_open_tag
and set On
or 1
.
short_open_tag = On
Wamp 2.5 contains two versions of php.ini. If you're running php inside Apache (as I guess you are) you need to change the one in \bin\apache\apache2.4.9\bin.
精彩评论