PHP: <? ?> Tags Not Working in PHP 5.3.x under UNIX / Linux

by on January 18, 2011 · 3 comments· LAST UPDATED June 5, 2012

in

I've recently installed php 5.3.5 in my UNIX box and my old working php code not working. It displays code in pages which is in <? ... my code ... ?> php tags. How do I fix this problem?

You need to allow the php tag by editing php.ini file. Using short tags should be avoided when developing applications or libraries that are meant for redistribution, or deployment on PHP servers which are not under your control, because short tags may not be supported on the target server. For portable, redistributable code, be sure not to use short tags.
# vi php.ini
Make the changes as follows:

 
short_open_tag = On
 

Save and close the file. Reload or restart the apache web server:
# apachectl -k restart
OR
# service httpd restart

TwitterFacebookGoogle+PDF versionFound an error/typo on this page? Help us!

{ 3 comments… read them below or add one }

1 Deprecation Unnecessary January 25, 2011 at 3:15 pm

The PHP developers are planning on removing short tags in PHP 6. 5.3 disabled short tags as a deprecation step. Contact the PHP developer’s mailing list to tell them how terrible of an idea this is. If enough people yell loud enough, maybe we can get them to do the right thing and leave it in.

Reply

2 Beaver6813 June 18, 2011 at 11:46 am

Removing short tags is a brilliant idea. Two sets of opening and closing tags for PHP was an awful idea in the first place. How anyone is so lazy that they can’t use <?php is beyond me.

Reply

3 Jarrod Mosen June 20, 2012 at 4:15 am

A brilliant idea? “Here, quick, let’s ruin a sizable portion of completely functional PHP code for no reason!”

Rasmus Lerdorf, in a mailing list, stated that they would not be removed.

Reply

Leave a Comment

Tagged as: , , , , , , , , , , , , ,

Previous Faq:

Next Faq: