I am following along with the tutorials in ‘Easy PHP Websites with Zend Framework’ and wanted to install PHPUnit.
System: Mac OS x Lion, PHP running locally (Not MAMP)
Pear was installed and working fine, I upgraded it to the latest.
Installed PHPUnit using
sudo pear install phpunit/PHPUnit
terminal did some work and installed it without errors
The in my terminal I did
phpunit --version
this returns/does nothing as follows (Username removed)
Machine:~ Username$ phpunit --version
Machine:~ Username$ sudo phpunit --version
Machine:~ Username$
Was worried it some how did not install so I check for the PHPUnit files and they do exist under /usr/lib/php/phpunit
Also checked that the phpunit exe exists which it does under /usr/bin
edited .profile as well as .bash_profile to include the /usr/bin path to have
export PATH=/usr/bin:$PATH
then restarted terminal
running
echo $PATH
shows
/opt/local/bin:/opt/local/sbin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/X11/bin:/usr/local/git/bin:/Users/xxxxx/development/frameworks/ZendFramework-1.11.11/bin
php.ini includes is
include_path = ".:/usr/lib/php/pear:/Library/Server/Web/Data/Sites/ZendFramework-1.11.11/library"
Where xxxxx is my username on the Mac
even going into /usr/bin in terminal and using phpunit –version returns nothing
in case its relevant my PEAR config shows
Configuration (channel pear.php.net):
=====================================
...
...
PEAR executables directory bin_dir /usr/bin
PEAR documentation directory doc_dir /usr/lib/php/doc
PHP extension directory ext_dir /usr/lib/php/extensions/.....
PEAR directory php_dir /usr/lib/php
PEAR data directory data_dir /usr/lib/php/data
PHP CLI/CGI binary php_bin /usr/bin/php
php.ini location php_ini <not set>
....
....
PEAR Installer temp directory temp_dir /private/tmp/pear/temp
PEAR test directory test_dir /usr/lib/php/test
PEAR www files directory www_dir /usr/lib/php/htdocs
....
Also added the pear and phpunit directory to my php.ini includes path list.
Am at a loss as to why this does not want to work. Am sure its me and I have done something incorrectly….Any help appreciated.
Ok, solved this, finally after much reading and fiddling. Issue was with PEAR, not PHPUnit itself.
Found the issue by following the set up for PEAR onhttp://pear.php.net/manual/en/installation.checking.php
php.ini change from
.:/usr/lib/php/pear:/Library/Server/Web/Data/Sites/ZendFramework-1.11.11/library:/usr/lib/php/PHPUnit
to
.:/usr/lib/php/pear:/Library/Server/Web/Data/Sites/ZendFramework-1.11.11/library:/usr/lib/php
solved this issue immediately.
phpunit –version now works