重新配置了环境一如既往的顺利,知道开始安装phpunit。。。。
在安装phpunit的时候出现错误:could not extract the package.xml from 'xxxx/phpunit'的错误:
1: D:\Program Files\php-5.2.17>pear install phpunit/PHPUnit
2: Did not download optional dependencies: ezc/ConsoleTools, use --alldeps to downl
3: oad automatically
4: phpunit/PHPUnit can optionally use PHP extension "dbus"
5: phpunit/PHP_CodeCoverage can optionally use PHP extension "xdebug" (version >= 2
6: .0.5)
7: phpunit/PHPUnit_MockObject can optionally use PHP extension "soap"
8: downloading PHPUnit-3.5.13.tgz ...
9: Starting to download PHPUnit-3.5.13.tgz (118,553 bytes)
10: ..........................done: 118,553 bytes
11: could not extract the package.xml file from "D:\Program Files\php-5.2.17\tmp\PHP
12: Unit-3.5.13.tgz" Unable to create directory 'D:/Program/mp4AC.tmp'
13: Unable to create path for D:/Program/mp4AC.tmp/package.xml
14: Download of "phpunit/PHPUnit" succeeded, but it is not a valid package archive
15: Error: cannot download "phpunit/PHPUnit"
16: downloading DbUnit-1.0.1.tgz ...
17: Starting to download DbUnit-1.0.1.tgz (39,055 bytes)
18: ...done: 39,055 bytes
19: could not extract the package.xml file from "D:\Program Files\php-5.2.17\tmp\DbU
20: nit-1.0.1.tgz" Unable to create directory 'D:/Program/mp4AD.tmp'
21: Unable to create path for D:/Program/mp4AD.tmp/package.xml
22: Download of "phpunit/DbUnit" succeeded, but it is not a valid package archive
23: Error: cannot download "phpunit/DbUnit"
24: downloading File_Iterator-1.2.6.tgz ...
25: Starting to download File_Iterator-1.2.6.tgz (3,439 bytes)
26: ...done: 3,439 bytes
27: could not extract the package.xml file from "D:\Program Files\php-5.2.17\tmp\Fil
28: e_Iterator-1.2.6.tgz" Unable to create directory 'D:/Program/mp4AE.tmp'
29: Unable to create path for D:/Program/mp4AE.tmp/package.xml
30: Download of "phpunit/File_Iterator" succeeded, but it is not a valid package arc
31: hive
32: Error: cannot download "phpunit/File_Iterator"
33: downloading Text_Template-1.1.0.tgz ...
34: Starting to download Text_Template-1.1.0.tgz (2,783 bytes)
35: ...done: 2,783 bytes
36: could not extract the package.xml file from "D:\Program Files\php-5.2.17\tmp\Tex
37: t_Template-1.1.0.tgz" Unable to create directory 'D:/Program/mp4AF.tmp'
38: Unable to create path for D:/Program/mp4AF.tmp/package.xml
39: Download of "phpunit/Text_Template" succeeded, but it is not a valid package arc
40: hive
41: Error: cannot download "phpunit/Text_Template"
42: downloading PHP_CodeCoverage-1.0.4.tgz ...
43: Starting to download PHP_CodeCoverage-1.0.4.tgz (115,029 bytes)
44: ...done: 115,029 bytes
45: could not extract the package.xml file from "D:\Program Files\php-5.2.17\tmp\PHP
46: _CodeCoverage-1.0.4.tgz" Unable to create directory 'D:/Program/mp4B1.tmp'
47: Unable to create path for D:/Program/mp4B1.tmp/package.xml
48: Download of "phpunit/PHP_CodeCoverage" succeeded, but it is not a valid package
49: archive
50: Error: cannot download "phpunit/PHP_CodeCoverage"
51: downloading PHP_Timer-1.0.0.tgz ...
52: Starting to download PHP_Timer-1.0.0.tgz (2,536 bytes)
53: ...done: 2,536 bytes
54: could not extract the package.xml file from "D:\Program Files\php-5.2.17\tmp\PHP
55: _Timer-1.0.0.tgz" Unable to create directory 'D:/Program/mp4B2.tmp'
56: Unable to create path for D:/Program/mp4B2.tmp/package.xml
57: Download of "phpunit/PHP_Timer" succeeded, but it is not a valid package archive
58:
59: Error: cannot download "phpunit/PHP_Timer"
60: downloading PHPUnit_MockObject-1.0.8.tgz ...
61: Starting to download PHPUnit_MockObject-1.0.8.tgz (18,199 bytes)
62: ...done: 18,199 bytes
63: could not extract the package.xml file from "D:\Program Files\php-5.2.17\tmp\PHP
64: Unit_MockObject-1.0.8.tgz" Unable to create directory 'D:/Program/mp4B3.tmp'
65: Unable to create path for D:/Program/mp4B3.tmp/package.xml
66: Download of "phpunit/PHPUnit_MockObject" succeeded, but it is not a valid packag
67: e archive
68: Error: cannot download "phpunit/PHPUnit_MockObject"
69: downloading PHPUnit_Selenium-1.0.2.tgz ...
70: Starting to download PHPUnit_Selenium-1.0.2.tgz (16,412 bytes)
71: ...done: 16,412 bytes
72: could not extract the package.xml file from "D:\Program Files\php-5.2.17\tmp\PHP
73: Unit_Selenium-1.0.2.tgz" Unable to create directory 'D:/Program/mp4B4.tmp'
74: Unable to create path for D:/Program/mp4B4.tmp/package.xml
75: Download of "phpunit/PHPUnit_Selenium" succeeded, but it is not a valid package
76: archive
77: Error: cannot download "phpunit/PHPUnit_Selenium"
78: downloading YAML-1.0.5.tgz ...
79: Starting to download YAML-1.0.5.tgz (9,966 bytes)
80: ...done: 9,966 bytes
81: could not extract the package.xml file from "D:\Program Files\php-5.2.17\tmp\YAM
82: L-1.0.5.tgz" Unable to create directory 'D:/Program/mp4B5.tmp'
83: Unable to create path for D:/Program/mp4B5.tmp/package.xml
84: Download of "symfony/YAML" succeeded, but it is not a valid package archive
85: Error: cannot download "symfony/YAML"
86: downloading XML_RPC2-1.0.8.tgz ...
87: Starting to download XML_RPC2-1.0.8.tgz (67,063 bytes)
88: ...done: 67,063 bytes
89: could not extract the package.xml file from "D:\Program Files\php-5.2.17\tmp\XML
90: _RPC2-1.0.8.tgz" Unable to create directory 'D:/Program/mp4B6.tmp'
91: Unable to create path for D:/Program/mp4B6.tmp/package.xml
92: Download of "pear/XML_RPC2" succeeded, but it is not a valid package archive
93: Error: cannot download "pear/XML_RPC2"
94: downloading PHP_TokenStream-1.0.1.tgz ...
95: Starting to download PHP_TokenStream-1.0.1.tgz (7,250 bytes)
96: ...done: 7,250 bytes
97: could not extract the package.xml file from "D:\Program Files\php-5.2.17\tmp\PHP
98: _TokenStream-1.0.1.tgz" Unable to create directory 'D:/Program/mp4B7.tmp'
99: Unable to create path for D:/Program/mp4B7.tmp/package.xml
100: Download of "phpunit/PHP_TokenStream" succeeded, but it is not a valid package a
101: rchive
102: Error: cannot download "phpunit/PHP_TokenStream"
103: downloading Cache_Lite-1.7.9.tgz ...
104: Starting to download Cache_Lite-1.7.9.tgz (30,318 bytes)
105: ...done: 30,318 bytes
106: could not extract the package.xml file from "D:\Program Files\php-5.2.17\tmp\Cac
107: he_Lite-1.7.9.tgz" Unable to create directory 'D:/Program/mp4B8.tmp'
108: Unable to create path for D:/Program/mp4B8.tmp/package.xml
109: Download of "pear/Cache_Lite" succeeded, but it is not a valid package archive
110: Error: cannot download "pear/Cache_Lite"
111: downloading ConsoleTools-1.6.1.tgz ...
112: Starting to download ConsoleTools-1.6.1.tgz (869,994 bytes)
113: ...done: 869,994 bytes
114: could not extract the package.xml file from "D:\Program Files\php-5.2.17\tmp\Con
115: soleTools-1.6.1.tgz" Unable to create directory 'D:/Program/mp4B9.tmp'
116: Unable to create path for D:/Program/mp4B9.tmp/package.xml
117: Download of "ezc/ConsoleTools" succeeded, but it is not a valid package archive
118: Error: cannot download "ezc/ConsoleTools"
119: downloading Base-1.8.tgz ...
120: Starting to download Base-1.8.tgz (236,357 bytes)
121: ...done: 236,357 bytes
122: could not extract the package.xml file from "D:\Program Files\php-5.2.17\tmp\Bas
123: e-1.8.tgz" Unable to create directory 'D:/Program/mp4BA.tmp'
124: Unable to create path for D:/Program/mp4BA.tmp/package.xml
125: Download of "ezc/Base" succeeded, but it is not a valid package archive
126: Error: cannot download "ezc/Base"
127: Download failed
128: install failed
截图如下:
在无数次的环境检查之后确认并非环境问题引起,后来求助于google,得文《http://stackoverflow.com/questions/5265494/issue-upgrading-to-phpunit-3-5-13》,错误信息和我如出一则,而解决办法也在第一个回复中得到,原来竟是路径中含有空格导致"我的路径是D:/program files/", 修改方法也提到了只要修改pear.ini中的temp_dir,指定到一个没有空格的目录路径即可,(pear.ini在你安装pear的时候决定,如果没有更改或将会放置在C:/windows下)
特别一提:pear.ini中的格式是一个序列化之后的数组,所以你在这里不能直接更改路径,同时你需要修改偏移量,最好的方式是,你将该字符考出,反序列化之后在进行修改,修改完之后的序列化字符串重新覆盖pear.ini中数据即可。
再次安装phpunit就OK了:
1: D:\Program Files\php-5.2.17>pear install phpunit/PHPUnit
2: Did not download optional dependencies: ezc/ConsoleTools, use --alldeps to downl
3: oad automatically
4: phpunit/PHPUnit can optionally use PHP extension "dbus"
5: phpunit/PHP_CodeCoverage can optionally use PHP extension "xdebug" (version >= 2
6: .0.5)
7: phpunit/PHPUnit_MockObject can optionally use PHP extension "soap"
8: downloading PHPUnit-3.5.13.tgz ...
9: Starting to download PHPUnit-3.5.13.tgz (118,553 bytes)
10: ......................done: 118,553 bytes
11: downloading DbUnit-1.0.1.tgz ...
12: Starting to download DbUnit-1.0.1.tgz (39,055 bytes)
13: ...done: 39,055 bytes
14: downloading File_Iterator-1.2.6.tgz ...
15: Starting to download File_Iterator-1.2.6.tgz (3,439 bytes)
16: ...done: 3,439 bytes
17: downloading Text_Template-1.1.0.tgz ...
18: Starting to download Text_Template-1.1.0.tgz (2,783 bytes)
19: ...done: 2,783 bytes
20: downloading PHP_CodeCoverage-1.0.4.tgz ...
21: Starting to download PHP_CodeCoverage-1.0.4.tgz (115,029 bytes)
22: ...done: 115,029 bytes
23: downloading PHP_Timer-1.0.0.tgz ...
24: Starting to download PHP_Timer-1.0.0.tgz (2,536 bytes)
25: ...done: 2,536 bytes
26: downloading PHPUnit_MockObject-1.0.8.tgz ...
27: Starting to download PHPUnit_MockObject-1.0.8.tgz (18,199 bytes)
28: ...done: 18,199 bytes
29: downloading PHPUnit_Selenium-1.0.2.tgz ...
30: Starting to download PHPUnit_Selenium-1.0.2.tgz (16,412 bytes)
31: ...done: 16,412 bytes
32: downloading YAML-1.0.5.tgz ...
33: Starting to download YAML-1.0.5.tgz (9,966 bytes)
34: ...done: 9,966 bytes
35: downloading XML_RPC2-1.0.8.tgz ...
36: Starting to download XML_RPC2-1.0.8.tgz (67,063 bytes)
37: ...done: 67,063 bytes
38: downloading PHP_TokenStream-1.0.1.tgz ...
39: Starting to download PHP_TokenStream-1.0.1.tgz (7,250 bytes)
40: ...done: 7,250 bytes
41: downloading Cache_Lite-1.7.9.tgz ...
42: Starting to download Cache_Lite-1.7.9.tgz (30,318 bytes)
43: ...done: 30,318 bytes
44: downloading ConsoleTools-1.6.1.tgz ...
45: Starting to download ConsoleTools-1.6.1.tgz (869,994 bytes)
46: ...done: 869,994 bytes
47: downloading Base-1.8.tgz ...
48: Starting to download Base-1.8.tgz (236,357 bytes)
49: ...done: 236,357 bytes
50: install ok: channel://pear.phpunit.de/File_Iterator-1.2.6
51: install ok: channel://pear.phpunit.de/Text_Template-1.1.0
52: install ok: channel://pear.phpunit.de/PHP_Timer-1.0.0
53: install ok: channel://pear.phpunit.de/PHPUnit_Selenium-1.0.2
54: install ok: channel://pear.symfony-project.com/YAML-1.0.5
55: install ok: channel://pear.php.net/Cache_Lite-1.7.9
56: install ok: channel://components.ez.no/Base-1.8
57: install ok: channel://pear.phpunit.de/DbUnit-1.0.1
58: install ok: channel://pear.phpunit.de/PHPUnit_MockObject-1.0.8
59: install ok: channel://pear.php.net/XML_RPC2-1.0.8
60: install ok: channel://components.ez.no/ConsoleTools-1.6.1
61: install ok: channel://pear.phpunit.de/PHP_TokenStream-1.0.1
62: install ok: channel://pear.phpunit.de/PHP_CodeCoverage-1.0.4
63: install ok: channel://pear.phpunit.de/PHPUnit-3.5.13
安装成功之后就可以看到phpunit的命令了。