≡ Menu

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

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

Share this tutorial on:

Like this? Follow us on Twitter OR support us by using Patreon

{ 3 comments… add one }
  • Deprecation Unnecessary January 25, 2011, 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.

  • Beaver6813 June 18, 2011, 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.

  • Jarrod Mosen June 20, 2012, 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.

Security: Are you a robot or human?

Leave a Comment

You can use these HTML tags and attributes: <strong> <em> <pre> <code> <a href="" title="">

   Tagged with: , , , , , , , , , , , , ,