简体   繁体   English

如何使用 EasyPHP 5.3.8 安装 PEAR?

[英]How to install PEAR with EasyPHP 5.3.8?

I'm learning Yii and following ebook written by Jeffrey Winesett , the application is built upon TDD.我正在学习 Yii 并遵循Jeffrey Winesett 编写的电子书,该应用程序是基于 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 ).所以我需要安装 PHPUnit 来编写单元测试,这导致我发布了帮助为我的 Windows 7 安装 PEAR 的帖子(参考链接 1链接 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.并且在上述网站中,作者一直告诉我使用go-pear.bat ,它在我的 EasyPHP 5.3.8中不存在,这也是我发言时的最新版本。

Even in this EasyPHP forum post we cannot find the answer.即使在这个 EasyPHP 论坛帖子中,我们也找不到答案。

So the question is, how to install PEAR with EasyPHP 5.3.8?那么问题来了,如何用 EasyPHP 5.3.8 安装 PEAR?

I'm using:我在用着:

  • Netbeans PHP 7.0.1 as IDE for PHP. Netbeans PHP 7.0.1 作为 PHP 的 IDE。
  • EasyPHP 5.3.8 as AMP package EasyPHP 5.3.8 作为 AMP 包

In earlier versions of EasyPHP there is a BAT file that does the PEAR installation steps for you...在 EasyPHP 的早期版本中,有一个 BAT 文件可以为您执行 PEAR 安装步骤...

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.所以 EasyPHP 5.3.8 和 5.3.9 似乎没有这个 BAT 文件,所以这些是我安装 PEAR 库需要采取的步骤。

  • Rename改名
    \\Program Files (x86)\\EasyPHP-5.3.9\\php\\php539x120203095725\\php.ini
    to php.ini.disabledphp.ini.disabled
    This is because I found the local ini file caused lots of extension errors.这是因为我发现本地ini文件导致了很多扩展错误。 I don't think this file is used by Apache, so you can probably leave it disabled.我不认为这个文件被 Apache 使用,所以你可以禁用它。

  • Add two folders to your Windows PATH .将两个文件夹添加到 Windows PATH
    (Press Win+Pause to open System Settings > Advanced System Settings > Environment Variables > System Variables > Double-click Path.) (按Win+Pause打开系统设置 > 高级系统设置 > 环境变量 > 系统变量 > 双击路径。)
    Keep the existing folders there, but add another two, separated by semi-colons ;保留现有文件夹,但添加另外两个,用分号分隔;

    • Your php.exe folder.您的php.exe文件夹。 On my machine this was: c:\\Program Files (x86)\\EasyPHP-5.3.9\\php\\php539x120203095725在我的机器上,这是: c:\\Program Files (x86)\\EasyPHP-5.3.9\\php\\php539x120203095725
    • The location you would like to install PEAR.您要安装 PEAR 的位置。 I used D:\\Dev\\PEAR我用过D:\\Dev\\PEAR

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

  • Shift + Right-Click the folder you downloaded go-pear.phar to > Open command window here Shift + 右键单击​​您将go-pear.phar下载go-pear.phar的文件夹 > 在此处打开命令窗口

  • Type php go-pear.phar输入php go-pear.phar

  • Press enter to install system-wide PEAR (the default)按回车键安装系统范围的 PEAR(默认)

  • Type 1 to change the installation base.键入 1 以更改安装基础。 I chose D:\\Dev\\PEAR .我选择了D:\\Dev\\PEAR The other settings should be OK to leave as default.其他设置应该可以保留为默认值。 Press enter again (twice) when prompted.出现提示时再次按 Enter 键(两次)。

  • Run the REG file that was just created.运行刚刚创建的 REG 文件。 You can type D:\\Dev\\PEAR\\PEAR_ENV.reg and click yes when prompted.您可以键入D:\\Dev\\PEAR\\PEAR_ENV.reg并在出现提示时单击是。

  • 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.通过编辑EasyPHP-5.3.9\\conf_files\\php.ini并取消注释include_path指令并将 PEAR 路径添加到末尾,确保您的 Web 应用程序可以使用 PEAR 库。 Note that you have to use PEAR/pear.请注意,您必须使用 PEAR/pear。 Example:例子:

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

    EasyPHP will automatically restart Apache for you. EasyPHP 将自动为您重新启动 Apache。

You can then proceed to install other modules.然后,您可以继续安装其他模块。 For example, phpUnit is installed by typing:例如,通过键入以下内容安装 phpUnit:

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

the script go-pear.php doesn't work on some new php version.脚本 go-pear.php 不适用于某些新的 php 版本。 My solution :我的解决方案:

dowload in php folder the file from http://pear.php.net/go-pear.phar在 php 文件夹中从http://pear.php.net/go-pear.phar下载文件

(use the windows console in mode admin) and from php folder type : php go-pear.phar (在模式 admin 中使用 windows 控制台)和从 php 文件夹类型:php go-pear.phar

I'm just going to assume that ""EasyPHP"" has a normal/real php-cli interface.我只是假设“EasyPHP”有一个普通/真实的 php-cli 界面。

  • Download http://pear.php.net/go-pear and save it to the filesystem as go-pear.php下载http://pear.php.net/go-pear并将其保存到文件系统中作为 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运行: php go-pear.php并回答它问你的所有问题

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.这通常(如在 X/M/WTF-AMP 堆栈中)比试图从只是为了将 php 和 apache 粘合在一起的东西中运行一个过时的 pear 版本要可靠得多。

Here is the translation in french, with some more comments : * Voici la traduction en français, avec quelques commentaires supplémentaires.这是法语翻译,还有一些评论: * Voici la traduction en français, avec quelques commentaires supplementaires。 * *

  1. Créez un dossier PEAR_install dans le dossier d'EasyPHP. 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. 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 示例。

     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 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 : 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". 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. Gardez bien les dossiersexistants 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 : 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 : Ensuite le dossier où vous souhaitez installer PEAR :

     C:\\php\\pear;

    On aurait aussi bien sûr pu choisir :在 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. Mais ce choix n'est peut-être pas le meilleur au cas où vous voudriez passer à une 版本加上 récente d'EasyPHP。 Ne pas oublier de mettre le point virgule à la fin de chaque ajout Ne pas oublier de mettre le point virgule à la fin de chaque ajout

  4. Dans une fenêtre de commande, lancer la commande 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 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 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 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 : 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 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 cettes directive PEAR votre l'example 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 : 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. EasyPHP va redémarrer Apache Pour vous de façon automatique。 Vous pouvez ensuite vous lancer dans l'installation d'autres modules. Vous pouvez ensuite vous lancer dans l'installation d'autres 模块。

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

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM