phpunit – 错误的路径

栏目: PHP · 发布时间: 7年前

内容简介:翻译自:https://stackoverflow.com/questions/5022894/phpunit-wrong-path

有人知道我做错了什么吗?

我安装了phpunit,当我在/ opt / local / PEAR目录下时一切都很好,所以如果我去/ opt / local / PEAR目录并运行phpunit,我会得到:

PHPUnit 3.5.11 by Sebastian Bergmann.

Usage: phpunit [switches] UnitTest [UnitTest.php]

phpunit [switches]

blablabla

但如果我在另一条路上,我会得到:

Warning: require_once(PHP/CodeCoverage/Filter.php): failed to open stream: No such file or directory in /usr/local/bin/phpunit on line 38 
Fatal error: require_once(): Failed opening required ‘PHP/CodeCoverage/Filter.php’ (include_path=’.:/usr/lib/php’) in /usr/local/bin/phpunit on line 38

我知道我的PATH有问题.我该如何解决?

尝试将/ opt / local / PEAR添加到php.ini文件include_path.

//Before:
include_path='.:/usr/lib/php'
//After:
include_path='.:/usr/lib/php:/opt/local/PEAR'

您可能还需要重新启动Web服务器才能使更改生效.

正如RobertPitt评论的那样,这也可以在运行时完成而无需访问php.ini文件.

<?php
$path = '/opt/local/PEAR';
set_include_path(get_include_path() . PATH_SEPARATOR . $path);
?>

翻译自:https://stackoverflow.com/questions/5022894/phpunit-wrong-path


以上就是本文的全部内容,希望本文的内容对大家的学习或者工作能带来一定的帮助,也希望大家多多支持 码农网

查看所有标签

本站部分资源来源于网络,本站转载出于传递更多信息之目的,版权归原作者或者来源机构所有,如转载稿涉及版权问题,请联系我们

Windows黑客编程技术详解

Windows黑客编程技术详解

甘迪文 / 人民邮电出版社 / 2018-12 / 108

《Windows黑客编程技术详解》介绍的是黑客编程的基础技术,涉及用户层下的Windows编程和内核层下的Rootkit编程。本书分为用户篇和内核篇两部分,用户篇包括11章,配套49个示例程序源码;内核篇包括7章,配套28个示例程序源码。本书介绍的每个技术都有详细的实现原理,以及对应的示例代码(配套代码均支持32位和64位Windows 7、Windows 8.1及Windows 10系统),旨在......一起来看看 《Windows黑客编程技术详解》 这本书的介绍吧!

随机密码生成器
随机密码生成器

多种字符组合密码

XML、JSON 在线转换
XML、JSON 在线转换

在线XML、JSON转换工具

XML 在线格式化
XML 在线格式化

在线 XML 格式化压缩工具