PHP Notice: Please no longer include解决办法
PHP Notice: Please no longer include "PHPUnit/Framework.php". in /usr/share/php/PHPUnit/Framework.php on line 50
但自己是按照文档上说的安装了PHPUnit包了呀,后来发现想起来安装过程中由于家里网络问题其中一个依赖包出错了,但是别的包都提示安装成功了,然后自己是把那个失败的包PHP_CodeCoverage重新安装的,然后运行unit的时候就出现了上面的错误,于是自己慢慢摸索,然后做了以下步骤后,问题总算被解决了。
1. 打开pear的auto_discover选项
view plaincopy to clipboardprint?$ sudo pear config-set auto_discover 1
$ sudo pear config-set auto_discover 12. 检查已经安装的phpunit和其依赖包
view plaincopy to clipboardprint?$ sudo pear list -a
Installed packages, channel pear.phpunit.de:
============================================
Package Version State
DbUnit 1.0.3 stable
File_Iterator 1.2.6 stable
PHPUnit 3.5.15 stable
PHPUnit_MockObject 1.0.9 stable
PHPUnit_Selenium 1.0.3 stable
PHP_CodeCoverage 1.0.5 stable
PHP_Timer 1.0.2 stable
PHP_TokenStream 1.0.1 stable
Text_Template 1.1.0 stable
$ sudo pear list -a
Installed packages, channel pear.phpunit.de:
============================================
Package Version State
DbUnit 1.0.3 stable
File_Iterator 1.2.6 stable
PHPUnit 3.5.15 stable
PHPUnit_MockObject 1.0.9 stable
PHPUnit_Selenium 1.0.3 stable
PHP_CodeCoverage 1.0.5 stable
PHP_Timer 1.0.2 stable
PHP_TokenStream 1.0.1 stable
Text_Template 1.1.0 stable3. 卸载所有pear.phpunit.de channel下安装的和phpunit相关的包,这里有先后顺序,卸载的时候会有提示
view plaincopy to clipboardprint?$ sudo pear uninstall PHPUnit
$ sudo pear uninstall PHPUnit_MockObject
...
$ sudo pear uninstall PHPUnit
$ sudo pear uninstall PHPUnit_MockObject
...4. 重新安装PHPUnit包
view plaincopy to clipboardprint?$ sudo pear install pear.phpunit.de/PHPUnit
$ sudo pear install pear.phpunit.de/PHPUnit5. 再次运行“phpunit unit/DBTest.php”,问题解决。
作者“kongxx的专栏”
上一篇: php正则 函数preg_match_all 重复匹配有关问题
下一篇: 数组的介绍
推荐阅读
-
Notice: Trying to get property of non-object problem(PHP)解决办法
-
PHP运行出现Notice : Use of undefined constant 的解决办法
-
PHP使用Session遇到的一个Permission denied Notice解决办法
-
测试PHP代码时PHP提示Notice:Undefinedvariable问题及解决办法
-
PHP Notice: Please no longer include解决办法
-
PHP中出现Notice: Undefined index的三种解决办法
-
PHP提示Notice: Undefined variable的解决办法
-
PHP运行出现Notice : Use of undefined constant 的解决办法
-
php中require/include 包含相对路径的解决办法
-
include_once"/include/a.php" 和include_once" . /include/a.php"有什么区别?解决办法