windows 如何设置 PHPUnit 3.5.15 和 Zend 框架 1.11.10?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/7318319/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
How to setup PHPUnit 3.5.15 and Zend framework 1.11.10?
提问by David
After spending 1 good day I still unable to resolve the following error:
在度过了美好的一天后,我仍然无法解决以下错误:
Testing Note: PHPUnit was not found in your include_path, therefore no testing actions will be created.
测试注意:在您的 include_path 中找不到 PHPUnit,因此不会创建测试操作。
This error appears when I create a new Zend-project.
当我创建一个新的 Zend 项目时会出现这个错误。
What i have tried so far:
到目前为止我尝试过的:
- Updated Pear to the latest version.
- changed config to autodiscover as described on the readme of phpunit.
- Also I changed the include path of my php.ini file to the following:
- 将 Pear 更新到最新版本。
- 如 phpunit 的自述文件中所述,将配置更改为自动发现。
- 此外,我将 php.ini 文件的包含路径更改为以下内容:
include_path=".;S:\PHP\PEAR;S:\PHP\PEAR\PHPUnit;S:\Framework\ZendFramework-1.11.10\library;S:\PHP\PEAR\PEAR"
include_path=".;S:\PHP\PEAR;S:\PHP\PEAR\PHPUnit;S:\Framework\ZendFramework-1.11.10\library;S:\PHP\PEAR\PEAR"
However I am still receiving the error.
但是我仍然收到错误。
What does work is the commandline phpunit , the correct php.ini is loaded (checked by phpinfo()) so what am I missing?
什么是命令行 phpunit ,正确的 php.ini 已加载(由 phpinfo() 检查),那么我错过了什么?
Additional information
附加信息
C:\Users\Dev\Desktop>php --ini
Configuration File (php.ini) Path: C:\Windows
Loaded Configuration File: S:\PHP\php.ini
Scan for additional .ini files in: (none)
Additional .ini files parsed: (none)
Instalation information:
安装信息:
- Apache 2.2.19
- php 5.3.6
- mysql 5.5.15
- 阿帕奇 2.2.19
- php 5.3.6
- mysql 5.5.15
I did not install xammp or wammp just manual install to learn.
我没有安装 xammp 或 wammp 只是手动安装来学习。
php.ini that load :=> http://pastebin.com/bpqKhF7U
加载的 php.ini :=> http://pastebin.com/bpqKhF7U
Update!
更新!
Php include_path is ambiguous the error you receive is because your .zf.ini is wrongly configured (mine was)
Php include_path 不明确,您收到的错误是因为您的 .zf.ini 配置错误(我的是)
.zf.ini can be found @ users home folder
.zf.ini 可以在@users 主文件夹中找到
It looks like this:
它看起来像这样:
php.include_path=".;S:\xampp\php\;S:\xampp\php\PEAR;S:\xampp\php\PEAR\PHPUnit"
php.include_path=".;S:\xampp\php\;S:\xampp\php\PEAR;S:\xampp\php\PEAR\PHPUnit"
After changing this parameter to the right locations the error did not occur anymore!.
将此参数更改为正确位置后,错误不再发生!。
采纳答案by Fabio
PHP command line interpreter in windows can use a different php.ini
file, see my answer to this question testing zend with phpunit gives me "The mysql driver is not currently installed"
Windows 中的 PHP 命令行解释器可以使用不同的php.ini
文件,请参阅我对此问题的回答,使用 phpunit 测试 zend 给我“当前未安装 mysql 驱动程序”
You should check that the phpunit
is available on your path, what happen if you type phpunit
in a command prompt? Is phpunit in your path?
你应该检查phpunit
你的路径上是否可用,如果你输入phpunit
命令提示符会发生什么?phpunit 在您的路径中吗?
Anyway the best method to install PHPUnit is the pear method, it should take care of any aspect. I always used that method (Linux and Mac) and everything worked with no need to change the path nor the php.ini
file. Don't know if this is also true for Windows.
无论如何,安装 PHPUnit的最佳方法是梨形方法,它应该照顾任何方面。我总是使用这种方法(Linux 和 Mac),一切正常,无需更改路径或php.ini
文件。不知道这是否也适用于 Windows。
Update
更新
There is more than one way to change the loaded ini file see all of them here
有不止一种方法可以更改加载的 ini 文件,请在此处查看所有方法
The easiest way could be with an environment variable:
最简单的方法可能是使用环境变量:
PHPRC=path of your current apache php.ini file
or with a registry setting
或使用注册表设置
[HKEY_LOCAL_MACHINE\SOFTWARE\PHP], value of IniFilePath (Windows only)
In this way you should be able to load the same file for the apache version. Or you can keep CLI configuration separated and replicate your include_path
setting in S:\PHP\php.ini
通过这种方式,您应该能够为 apache 版本加载相同的文件。或者您可以将 CLI 配置分开并复制您的include_path
设置S:\PHP\php.ini