简体   繁体   English

Zend Server CE上的PHPUnit出现问题-MacOSX

[英]Trouble with PHPUnit on Zend Server CE - MacOSX

I've installed Zend Server CE on my MacOS Lion, and everything is running smooth except from PHPUnit. 我已经在MacOS Lion上安装了Zend Server CE,除了PHPUnit之外,其他所有程序都运行顺利。

My installation of PHPUnit was made from the PERL that comes with Zend Server CE. 我的PHPUnit安装是由Zend Server CE随附的PERL完成的。

Here is the output from when I run phpunit through the console: 这是当我通过控制台运行phpunit时的输出:

Failed loading ”/usr/local/zend/lib/php_extensions/xdebug.so”:      dlopen(”/usr/local/zend/lib/php_extensions/xdebug.so”, 9): image not found
PHP Warning:  PHP Startup: Unable to load dynamic library     '/usr/local/zend/lib/php_extensions/mcrypt.so' -     dlopen(/usr/local/zend/lib/php_extensions/mcrypt.so, 9): Library not loaded:     /usr/lib/libltdl.3.dylib
  Referenced from: /usr/local/zend/lib/php_extensions/mcrypt.so
  Reason: image not found in Unknown on line 0
PHP Warning:  Xdebug MUST be loaded as a Zend extension in Unknown on line 0
PHP Fatal error:  Call to undefined method PHP_CodeCoverage_Filter::getInstance() in     /usr/local/bin/phpunit on line 39
PHP Stack trace:
PHP   1. {main}() /usr/local/bin/phpunit:0

Does anybody know what the problem or problems could be? 有人知道问题可能是什么吗?

Thanks and regards! 谢谢并恭祝安康!

Ok, this is my first answer. 好的,这是我的第一个答案。 So go easy on me. 所以,对我好一点。

Tonight I had the very same issues with Zend Server CE on OSX Lion. 今晚,我在OSX Lion上使用Zend Server CE遇到了同样的问题。 In order to solve them, you'll have to install xcode as the unix development tools are required. 为了解决这些问题,您必须安装xcode,因为需要unix开发工具

Let's get started, you have two issues: xdebug.so and libltdl.3.dylib 让我们开始吧,您有两个问题: xdebug.solibltdl.3.dylib

First xdebug.so is not found, to install it you should run the following from the command line: 找不到第一个 xdebug.so ,要安装它,您应该从命令行运行以下命令:

sudo su -

It will ask you for you password (if you don't have one just press the enter key). 它将询问您的密码(如果您没有密码,只需按Enter键)。 Then: 然后:

export CFLAGS="-arch i386 $CFLAGS"
export CCFLAGS="-arch i386 $CCFLAGS"
export CXXFLAGS="-arch i386 $CXXFLAGS"
export LDFLAGS="-arch i386 $LDFLAGS"
/usr/local/zend/bin/pear config-set php_ini /usr/local/zend/etc/php.ini
/usr/local/zend/bin/pecl install xdebug

The first four lines, force the compiler to generate a 32 bit binary, as Zend Server is a 32 bit binary and OSX Lion is a 64 bit operating system. 前四行迫使编译器生成32位二进制文​​件,因为Zend Server是32位二进制文​​件,而OSX Lion是64位操作系统。

Alright, now you should have xdebug.so installed on */usr/local/zend/lib/php_extensions*, just make sure that your /usr/local/zend/etc/php.ini file loads xdebug with the following line after all other extensions and before the [zend] section: 好吧,现在您应该在* / usr / local / zend / lib / php_extensions *上安装了xdebug.so ,只需确保/usr/local/zend/etc/php.ini文件通过以下行加载xdebug其他扩展名,在[zend]部分之前:

zend_extension=/usr/local/zend/lib/php_extensions/xdebug.so

Here's the fragment from my php.ini : 这是我的php.ini的片段:

...
;extension=odbc.so
;extension=imagick.so
zend_extension=/usr/local/zend/lib/php_extensions/xdebug.so

[zend]
zend_extension=/usr/local/zend/lib/ZendExtensionManager.so
...

If it doesn't please add it manually, then check if your php.ini file contains the following line and delete it as xdebug must me loaded as a Zend extension. 如果不是,请手动添加它,然后检查您的php.ini文件是否包含以下行并将其删除,因为xdebug必须作为Zend扩展名加载。

extension=xdebug.so

Second , as soon as you install xcode, libltdl.dylib will be available in /usr/lib , so you can create a symbolic link to it with the following command: 其次 ,一旦安装xcode, libltdl.dylib将在/ usr / lib中可用,因此您可以使用以下命令创建指向它的符号链接:

sudo ln -s /usr/lib/libltdl.dylib /usr/lib/libltdl.3.dylib

Next time you run phpunit everything should go smoothly (haven't tested any mcrypt functions though). 下次运行phpunit时,一切都会顺利进行(虽然尚未测试任何mcrypt函数)。

I just ran into the problem with the mcrypt, when I tried to start the phpunit. 当我尝试启动phpunit时,我遇到了mcrypt的问题。

The warning does not appear, if you run phpunit with sudo :) 如果使用sudo运行phpunit,则不会出现警告:)

sudo ./phpunit --version 须藤./phpunit --version

PHPUnit 3.6.6 by Sebastian Bergmann. Sebastian Bergmann编写的PHPUnit 3.6.6。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM