I'm trying to run PHPUnit tests, and need to change the short_open_tag
php.ini setting to On
.
Following the PHPUnit Manual, I have this in my phpunit.xml config file:
<phpunit>
<php>
<ini name='short_open_tag' value='On' />
</php>
...
</phpunit>
But this doesn't override the setting in the php.ini file being used (which is set to 'Off'). If I go into that file and manually change the value to 'On', it works. But, I'd like to leave that setting alone and only change it for the PHPUnit tests.
My best guess: My application (and phpunit.xml file) is on a VM, but it appears that PHPUnit is referencing the php.ini file on my local machine, so setting the configuration option from the phpunit.xml is affecting the php.ini file in the VM and not on my local machine. But I'm not sure how to change that.
Where have I gone wrong?
You cannot change the
short_open_tag
setting at runtime (which is what the configuration inphpunit.xml
is doing).If you look at the documentation,
short_open_tag
is in thePHP_INI_PERDIR
group.It means it can only be set in
php.ini
,.htaccess
,httpd.conf
or.user.ini
.