phpcodeigniterubuntuhomesteadphp-shorttags

How to enable PHP short_open_tag


For unknown reasons my PHP sites cannot parse PHP short open tags

e.g. <? rather than <?php. I believe this also affects the <?= tag, although I have not come across any issues directly relating to that in my project.

I have tried enabling short_open_tag in php.ini whilst using Homestead and Valet however I am still receiving parse errors.

Any help on how I can enable the use of PHP short open tags would be much appreciated as I am unable to perform a bulk find and replace.

Creating a basic php file and running ini_get("short_open_tag") returns 1. Which I presume means the setting is enabled? Yet a site running on valet still cannot parse shorthand tags.

NOTE: I do not want to use shorthand tags, however, this is a legacy project.

Useful information:


Solution

  • Update: This was resolved by switching to a Scotch Box vagrant box. Thanks all.