« 2011年6月的文章归档

Ubuntu 安装rails出现zlib error

这段时间把centos换成ubuntu后,环境重装,在装rails时出现了以下错误:

afeicool@localhost:~$ gem install rails
ERROR:  Loading command: install (LoadError)
no such file to load -- zlib
ERROR:  While executing gem ... (NameError)
uninitialized constant Gem::Commands::InstallCommand

解决方案:

apt-get install zlib-bin zlib1g-dev
cd path/to/your ruby source dir/ext/zlib
ruby extconf.rb –with-zlib-include=/usr/include –with-zlib-lib=/usr/lib
make
make install

window中用pear安装phpunit

1.安装pear
1)在命令行中,进入php安装目录,运行:

go-pear.bat

(可能出现报错情况)
2)下载go-phar.bat至php安装目录,运行:

php go-pear.phar

3)双击刚产生的PEAR_ENV.reg ,导入注册表
4)此时pear应该安装成功了,更新至最新版本:

pear upgrade

(这一步挺重要的,phpunit貌似是使用pear的1.9.x才能安装)
2.安装phpunit:
1)添加phpunit的频道

pear channel-discover pear.phpunit.de
pear channel-discover components.ez.no
pear channel-discover pear.symfony-project.com

2)安装:

pear install phpunit/PHPUnit

若出现此错误:
Fatal error:require_once():Failed opening required ‘Structures/Graph.php’
解决方法如下,下载此压缩包:

http://download.pear.php.net/package/Structures_Graph-1.0.3.tgz

解压并把Structures目录复制到your path/php/PEAR/下

若出现:
could not extract the package.xml file
Error:cannot download “phpunit/XXXX”
可能是pear下载目录的路径有空格如:D:/program files/
解决方法如下:

pear config-set temp_dir "C:\tmp"
pear config-set download_dir "C:\tmp"

这里设置目录的路径无空格就行了,想设哪里到是无所谓。

最后测试下是否安装成功,cmd中运行:

phpunit