How to enable short open tags in PHP

  • by Tyler (236)
  • Time to complete: 1 minute

Enabling short open tags gives you access to opening your PHP script with "" as a replacement for "". These are very handy if you are used mixed HTML and PHP.


If you are not already logged into your machine, log in (ssh if necessary) and open /etc/php.ini. If you're familiar with vi:

vi /etc/php.ini

otherwise you can use

nano /etc/php.ini


You should find a line that says short_open_tag = Off change this to:

short_open_tag = On

If the line doesn't exist just add it.


Depending on your machine restart apache. On Centos you can run:

/etc/init.d/httpd restart

On Ubuntu,

/etc/init.d/apache2 restart

After restarting apache you should be able to use short tags.