Skip to content


PHP CLI weirdness in Zend Server 6.2 on OS X 10.9 (Mavericks)

After upgrading recently to OS X 10.9 and installing Zend Server 6.2 I noticed that phpunit no longer functioned properly. Below is the output of the error I received.

/usr/local/zend/bin/phpunit IndexControllerTest.php
/usr/local/zend/bin/phpunit: line 2: ?php: No such file or directory
/usr/local/zend/bin/phpunit: line 3: /Applications: is a directory
/usr/local/zend/bin/phpunit: line 4: IndexControllerTest.php: command not found
/usr/local/zend/bin/phpunit: line 5: syntax error near unexpected token `('
/usr/local/zend/bin/phpunit: line 5: ` * Copyright (c) 2001-2013, Sebastian Bergmann <...>.

I decided to inspect the phpunit file in /usr/local/zend/bin.

vi /usr/local/zend/bin/phpunit
 
#!/usr/local/zend/bin/php
...

I could see it was pointing to the correct location of the php binary, weird! I decided to take a look at the php binary.

vi /usr/local/zend/bin/php
 
#!/bin/sh
# wrapper for PHP CLI which sources /etc/sce.rc, thus setting the correct LD_LIBRARY_PATH and also run php CLI with the correct php.ini file
. /etc/zce.rc
$ZCE_PREFIX/bin/php.bin -c $ZCE_PREFIX/etc/php.ini "$@"

Well now, this is not what I expected to find. It appears as though Zend replaced the php binary with a shell script that will execute the PHP Binary. Mavericks does not appreciate this and interprets (correctly) this file as a shell script instead of the PHP Binary !?!

Here is what I did to fix this:

sudo cp /etc/php.ini /etc/php.ini.backup
sudo ln -s /usr/local/zend/bin/etc/php.ini /etc/php.ini
 
sudo mv /usr/local/zend/bin/php /usr/local/zend/bin/php.backup
sudo ln -s /usr/local/zend/bin/php.bin /usr/local/zend/bin/php

All is once again right with the world.

/usr/local/zend/bin/phpunit --version
PHPUnit 3.7.28 by Sebastian Bergmann.

Posted in PHP, Zend Server.

0 Responses

Stay in touch with the conversation, subscribe to the RSS feed for comments on this post.

Some HTML is OK

(required)

(required, but never shared)

or, reply to this post via trackback.