BIOS,Windows, Linux, Software,Security, Domains, Web Hosting

How to enable PHP short tags

I find php outputs source in my new codes, finally I know it is a problem about the short tags settings. In fact I write php codes within <?php ?> normally, so I never get this issue. Now I know how to open or close short tags in php.

Making your knowledge as your requirement. 


If php short tag is not open. You will see the file source between <? and ?>.


Open PHP.ini, search <? or short_open_tag,  you will see some comments like this:

; This directive determines whether or not PHP will recognize code between
; <? and ?> tags as PHP source which should be processed as such. It's been
; recommended for several years that you not use the short tag "short cut" and
; instead to use the full <?php and ?> tag combination. With the wide spread use
; of XML and use of these tags by other languages, the server can become easily
; confused and end up parsing the wrong code in the wrong context. But because
; this short cut has been a feature for such a long time, it's currently still
; supported for backwards compatibility, but we recommend you don't use them.
; Default Value: On
; Development Value: Off
; Production Value: Off
short_open_tag = Off

; Allow ASP-style <% %> tags.
asp_tags = Off

Turn short_open_tag = off to short_open_tag=On, Then the source codes between <? and ?> will work properly.


Please restart your apache server when you finished your changes.

Using short tag is not recommended anymore, try to use a complete php tag <?php ?> instead. 

Related Articles


Leave a Reply

Subscribe to BootBeta Comments RSS feed to receive notification of latest comments posted.


  • Enter Email Address:

Recent Post

Copyright@ 2010-2014 Bootbeta All Rights Reserved.
HooBlog Ver 1.5 Build 20140530