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.

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

报告相同问题?

悬赏问题

  • ¥35 平滑拟合曲线该如何生成
  • ¥100 c语言,请帮蒟蒻写一个题的范例作参考
  • ¥15 名为“Product”的列已属于此 DataTable
  • ¥15 安卓adb backup备份应用数据失败
  • ¥15 eclipse运行项目时遇到的问题
  • ¥15 关于#c##的问题:最近需要用CAT工具Trados进行一些开发
  • ¥15 南大pa1 小游戏没有界面,并且报了如下错误,尝试过换显卡驱动,但是好像不行
  • ¥15 没有证书,nginx怎么反向代理到只能接受https的公网网站
  • ¥50 成都蓉城足球俱乐部小程序抢票
  • ¥15 yolov7训练自己的数据集