ZendServer installs PHP CLI as part of the installation, and, as is customary for PHP 4.3+, includes a PEAR installer. It’s a good idea to install PEAR before installing PHPUnit as per the recommendation here.
- Open Zend\ZendServer\bin\go-pear.bat and change the line:
%PHP_BIN% -d output_buffering=0 -d PEAR\go-pear.pharto (see PHAR Runtime Configuration):
%PHP_BIN% -d output_buffering=0 -d phar.require_hash=0 PEAR\go-pear.pharThis will stop the fatal error:
phar...does not have a signatureas by default PHP will not process a PHAR archive without a signature.
- Run go-pear.bat
For Windows 7, make sure you open the console as an administrator, or the installer won’t be able to create some folders in the default install locations. At the command prompt enter:
#cd \program files\zend\zendserver\binand you should get something like this (I selected the system-wide install and accepted the default locations):
If the installation succeeded, you should see something like:
Note that c:\program files\zend\zendserver\bin is already in Windows Path, thanks to ZendServer.
- Update PEAR Trying to install PHPUnit at this point will fail, complaining of an outdated installer. Update the PEAR package:
# pear channel-update pear.php.net
# pear upgrade pear
- Add the PHPUnit channels – see Installing PHPUnit
# pear channel-discover pear.phpunit.de
# pear channel-discover pear.symfony-project.com
- Finally install PHPUnit
# pear install phpunit/PHPUnitIf the installation runs successfully you should see:
You can check your PHPUnit by running it from the command prompt:
As of this writing I’m using Zend Server CE version 5.1.0 for my WAMP stack on a Windows 7 64-bit machine. I was recently researching some open source tools that required PEAR yet for some reason I had not installed that yet. The PEAR installation was fairly straight forward but there were a couple small detours. I’ve documented my PEAR installation here for reference.
- Go to http://pear.php.net/go-pear, copy all of the contents on this page and save the file as go-pear.php in your C:\Program Files (x86)\Zend\Apache2\htdocs\ directory.
- Open your web browser and go to http://localhost/go-pear.php. Click the “Next >>” link. (NOTE: As of this writing the Go-PEAR installer is at version 1.1.6 and I’m installing PEAR version 1.9.4.)
- Set the Installation prefix ($prefix) field to C:\Program Files (x86)\Zend\ZendServer\bin\ (NOTE: Don’t forget the trailing slash “\” after bin.)
- Scroll down and click the Install button.
- After the PEAR installation is complete you need to add the PEAR installation path to your Windows “PATH” environment variables. Right click on My Computer and select Properties. Go to Advanced system settings -> Environment Variables -> under System variables scroll down to the Variable “Path”, highlight it, and click Edit. At the end of this string add “;C:\Program Files (x86)\Zend\ZendServer\bin\PEAR” (NOTE: Do not include the double quotes and be sure not to add a trailing slash “\” after PEAR.) Click OK -> OK -> OK.
- Open your php.ini file with Notepad or any other text editor. Your php.ini file should be located here C:\Program Files (x86)\Zend\ZendServer\etc\php.ini. You need to add the PEAR path to the include path.[Zend]include_path=”.;C:\Program Files (x86)\Zend\ZendServer\share\ZendFramework\library;C:\Program Files (x86)\Zend\ZendServer\bin\PEAR”
- Save your php.ini file and restart your computer.
- After your computer is restarted open up the command prompt. On the command line enter “pear list” (NOTE: no double quotes) You should see the stable version listed for your PEAR install. If you don’t then you may be doing something different on your machine versus mine with regards to the installation. Check all paths in this reference to make sure they are correct.
- If you’re getting a PHP Error “Invalid configuration directive” when running your pear command then you need to make a small change to your pear.bat file. This file can be found in your C:\Program Files (x86)\Zend\ZendServer\bin\ directory. Scroll down to the :RUN section and modify the line with the PHP directive “-d include_path”. Add a “.;” before “%PHP_PEAR_INSTALL_DIR%” (NOTE: no double quotes) So, your line should look like this “include_path=’.;%PHP_PEAR_INSTALL_DIR%’”. Save your pear.bat file and rerun your pear list command.
… and that’s it. You now have PEAR installed and can use all of it’s functionality.
If you thought this post was helpful and would like to give back to the community then click on the “Donate” button and make a donation. Thank you.