How to install PEAR with EasyPHP 5.3.8?

Nam G VU picture Nam G VU · Sep 19, 2011 · Viewed 11.7k times · Source

I'm learning Yii and following ebook written by Jeffrey Winesett, the application is built upon TDD. So I need to install PHPUnit to write unit test, which leads me to posts help installing PEAR for my Windows 7 (ref. link 1, link 2).

And in those above sites, the author keep telling to use go-pear.bat which doesn't exist in my EasyPHP 5.3.8 which also be the latest version at the time of speaking.

Even in this EasyPHP forum post we cannot find the answer.

So the question is, how to install PEAR with EasyPHP 5.3.8?

I'm using:

  • Netbeans PHP 7.0.1 as IDE for PHP.
  • EasyPHP 5.3.8 as A M P package

Answer

Simon East picture Simon East · Mar 11, 2012

In earlier versions of EasyPHP there is a BAT file that does the PEAR installation steps for you...

C:\Program Files (x86)\EasyPHP-5.3.6.0\php\go-pear.bat

It also has most of the file-paths preconfigured, so you don't really need to change anything.


UPDATE:
So EasyPHP 5.3.8 and 5.3.9 don't seem to have this BAT file, so these are the steps I needed to take to get the PEAR library installed.

  • Rename
    \Program Files (x86)\EasyPHP-5.3.9\php\php539x120203095725\php.ini
    to php.ini.disabled
    This is because I found the local ini file caused lots of extension errors. I don't think this file is used by Apache, so you can probably leave it disabled.

  • Add two folders to your Windows PATH.
    (Press Win+Pause to open System Settings > Advanced System Settings > Environment Variables > System Variables > Double-click Path.)
    Keep the existing folders there, but add another two, separated by semi-colons ;

    • Your php.exe folder. On my machine this was: c:\Program Files (x86)\EasyPHP-5.3.9\php\php539x120203095725
    • The location you would like to install PEAR. I used D:\Dev\PEAR

  • Download http://pear.php.net/go-pear.phar

  • Shift + Right-Click the folder you downloaded go-pear.phar to > Open command window here

  • Type php go-pear.phar

  • Press enter to install system-wide PEAR (the default)

  • Type 1 to change the installation base. I chose D:\Dev\PEAR. The other settings should be OK to leave as default. Press enter again (twice) when prompted.

  • Run the REG file that was just created. You can type D:\Dev\PEAR\PEAR_ENV.reg and click yes when prompted.

  • Check that you have the latest version by typing:

    pear channel-update pear.php.net
    pear upgrade
    
  • Ensure your web-apps can use the PEAR library, by editing EasyPHP-5.3.9\conf_files\php.ini and uncommenting the include_path directive and adding your PEAR path to the end. Note that you have to use PEAR/pear. Example:

    include_path = ".;${path}\php\includes;d:\Dev\PEAR\pear"
    

    EasyPHP will automatically restart Apache for you.

You can then proceed to install other modules. For example, phpUnit is installed by typing:

pear config-set auto_discover 1
pear install pear.phpunit.de/PHPUnit