dongreng9864 2016-02-08 19:07
浏览 132
已采纳

更改phpunit.xml中的php.ini配置选项

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?

  • 写回答

1条回答 默认 最新

  • dongxing9219 2016-02-09 09:15
    关注

    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.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 linux驱动,linux应用,多线程
  • ¥20 我要一个分身加定位两个功能的安卓app
  • ¥15 基于FOC驱动器,如何实现卡丁车下坡无阻力的遛坡的效果
  • ¥15 IAR程序莫名变量多重定义
  • ¥15 (标签-UDP|关键词-client)
  • ¥15 关于库卡officelite无法与虚拟机通讯的问题
  • ¥15 目标检测项目无法读取视频
  • ¥15 GEO datasets中基因芯片数据仅仅提供了normalized signal如何进行差异分析
  • ¥100 求采集电商背景音乐的方法
  • ¥15 数学建模竞赛求指导帮助