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

last updated in Categories ,

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
# service httpd restart


Posted by: Vivek Gite

The author is the creator of nixCraft and a seasoned sysadmin, DevOps engineer, and a trainer for the Linux operating system/Unix shell scripting. Get the latest tutorials on SysAdmin, Linux/Unix and open source topics via RSS/XML feed or weekly email newsletter.

3 comment

  1. 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.

  2. 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.

  3. 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.

    Still, have a question? Get help on our forum!