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

🐧 Get the latest tutorials on Linux, Open Source & DevOps via RSS feed or Weekly email newsletter.

🐧 3 comments so far... add one

CategoryList of Unix and Linux commands
Disk space analyzersdf ncdu pydf
File Managementcat cp mkdir tree
FirewallAlpine Awall CentOS 8 OpenSUSE RHEL 8 Ubuntu 16.04 Ubuntu 18.04 Ubuntu 20.04
Network UtilitiesNetHogs dig host ip nmap
OpenVPNCentOS 7 CentOS 8 Debian 10 Debian 8/9 Ubuntu 18.04 Ubuntu 20.04
Package Managerapk apt
Processes Managementbg chroot cron disown fg jobs killall kill pidof pstree pwdx time
Searchinggrep whereis which
User Informationgroups id lastcomm last lid/libuser-lid logname members users whoami who w
WireGuard VPNAlpine CentOS 8 Debian 10 Firewall Ubuntu 20.04
3 comments… add one
  • Deprecation Unnecessary Jan 25, 2011 @ 15:15

    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 Jun 18, 2011 @ 11:46

    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 Jun 20, 2012 @ 4:15

    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.

Leave a Reply

Your email address will not be published.

Use HTML <pre>...</pre> for code samples. Still have questions? Post it on our forum