thanksd February 2016

Changing php.ini configuration option in phpunit.xml

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:

        <ini name='short_open_tag' value='On' />


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?


Jakub Zalas February 2016

You cannot change the short_open_tag setting at runtime (which is what the configuration in phpunit.xml is doing).

If you look at the documentation, short_open_tag is in the PHP_INI_PERDIR group.

It means it can only be set in php.ini, .htaccess, httpd.conf or .user.ini.

Post Status

Asked in February 2016
Viewed 2,295 times
Voted 11
Answered 1 times


Leave an answer