How to set short tag(<?) in PHP?

In your php.ini change the short_open_tag = Off if it's there to this:

short_open_tag = On

Click on your wamp icon then "PHP". Then click on "PHP Settings". There should be an option for "short open tag" which you should enable by clicking on it, it should show a check mark. Your wamp server will automatically restart in a few seconds and then short open tag will be enabled.

For non-wamp you need to go to your php.ini file and uncomment short_open_tag = On


set short_open_tag = 1 in your php.ini file.


sed -i 's/short_open_tag = Off/short_open_tag = On/g' /etc/php.ini
grep -n short_open_tag php.ini 

first line does inlien replace of php.ini to turn on short tags second makes sure its there