How to install PEAR with EasyPHP 5.3.8?

倖福魔咒の 提交于 2019-12-12 08:14:52

问题


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 exists 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?

Regards,

Nam

ps.

I'm using:

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

回答1:


the script go-pear.php doesn't work on some new php version. My solution :

dowload in php folder the file from http://pear.php.net/go-pear.phar

(use the windows console in mode admin) and from php folder type : php go-pear.phar




回答2:


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



回答3:


I'm just going to assume that ""EasyPHP"" has a normal/real php-cli interface.

  • Download http://pear.php.net/go-pear and save it to the filesystem as go-pear.php
  • Move to the directory where your saved your file
  • Run: php go-pear.php and answer all the questions it asks you

That usually (as in X/M/WTF-AMP stacks) works much more reliable than trying to get an outdated version of pear running from something that is just mean to glue php and apache together.




回答4:


Here is the translation in french, with some more comments : *Voici la traduction en français, avec quelques commentaires supplémentaires.*

  1. Créez un dossier PEAR_install dans le dossier d'EasyPHP. Ce dossier servira à déposer le fichier phar d'installation, et vous pouvez éventuellement y signaler que vous installez PEAR dans C:\php\PEAR par exemple.

    C:\Program Files\EasyPHP-5.3.8.1\PEAR_install
    
  2. Téléchargez dans le dossier PEAR_install le fichier issu de http://pear.php.net/go-pear.phar
  3. Ajoutez deux dossiers dans le PATH :

    Rappel : Pour accéder aux variables d’environnement sous Windows : Pressez Win+Pause pour ouvrir les Paramètres Système > Paramètres avancés > Variables d'environnement > Variables système > Double-cliquez sur "Path".

    Gardez bien les dossiers existants dans la variable path, et ajoutez juste les deux nouveaux dossiers séparés par des points-virgule.

    Tout d’abord le dossier qui contient php.exe :

    C:\Program Files\EasyPHP-5.3.8.1\php;
    

    Ensuite le dossier où vous souhaitez installer PEAR :

    C:\php\pear;
    

    On aurait aussi bien sûr pu choisir :

    C:\Program Files\EasyPHP-5.3.8.1\pear;
    

    Mais ce choix n'est peut-être pas le meilleur au cas où vous voudriez passer à une version plus récente d'EasyPHP. Ne pas oublier de mettre le point virgule à la fin de chaque ajout

  4. Dans une fenêtre de commande, lancer la commande

    C:\Program Files\EasyPHP-5.3.8.1\PEAR\php go-pear.phar
    

    Bien entendu, il faut bien lire les warnings qui s’affichent et agir en conséquence

  5. Lancer le fichier REG qui a été créé dans C:\php\pear\PEAR_ENV.reg

  6. Si ce n'est pas déjà fait, ajoutez dans le path le dossier C:\php\pear
  7. Vérifiez que vous avez la dernière version de PEAR en tapant :

     C:\php\pear\pear channel-update pear.php.net
     C:\php\pear\pear upgrade
    
  8. Vérifiez que vos web-apps peuvent utiliser la librairie PEAR en éditant le fichier de configuration (EasyPHP-5.3.8.1\conf_files\php.ini) puis en décommentant la directive include_path et en ajoutant à la fin de cette directive votre dossier PEAR.Voir l’exemple ci-dessous, et notez bien que vous devez utiliser PEAR/pear

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

    Dans notre cas ce sera :

    include_path = ".;${path}\php\includes;c:php\pear\pear"
    
  9. EasyPHP va redémarrer Apache pour vous de façon automatique. Vous pouvez ensuite vous lancer dans l’installation d’autres modules.

    Par exemple, vous pouvez installer le module PHPUnit en tapant :

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


来源:https://stackoverflow.com/questions/7471603/how-to-install-pear-with-easyphp-5-3-8

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!