Enabling Short Tags in PHP

php short tag
enabling php short tag tutorial

In this tutorial we look at how you enable short tags in PHP. Short Tags or short_open_tag as it is know in PHP.ini allows you the option to use short style opening tags for PHP code blocks e.g. <? instead of <?php.

To enable this feature on your server open PHP.ini file (this should be somewhere in your PHP install folder e.g.  /bin/php/phpx.x.x/php.ini) and change the short_open_tag setting to:

short_open_tag=On

Please note, it is not generally advised to use Short Tags as this can lead to future problems when migrating to server that doesnt have short_open_tag enabled. Personally I dont like this feature, it seems good at the time but trust me, there’ll be a time where it comes back to haunt you.

About the author

My name is Tom Jepson. I'm a Technical SEO freelancer with almost 20 years experience in Search Engine Optimisation. Proud Father, Python enthusiast, Self-confessed tech nerd, Ropey Guitarist and Photographer.

Leave a comment