PHP5.3.8のWindows環境にPEARをインストールする方法
phpをインストールしたフォルダに go-pear.bat というバッチファイルがあります。
http://www.bnote.net/windows/windows/win_pear.shtml
ないよ…。
PHP5.3.8にはgo-pear.batは入ってないみたいなので他の方法を探した。
go-pear.phar
下記からダウンロード。
http://pear.php.net/go-pear.phar
PHPをインストールしたディレクトリに「pear」フォルダを作ってそこに配置。
インストール実行
C:\php\pear>php go-pear.phar Are you installing a system-wide PEAR or a local copy? (system|local) [system] : Below is a suggested file layout for your new PEAR installation. To change individual locations, type the number in front of the directory. Type 'all' to change all of them or simply press Enter to accept these locations. 1. Installation base ($prefix) : C:\php\pear 2. Temporary directory for processing : C:\php\pear\tmp 3. Temporary directory for downloads : C:\php\pear\tmp 4. Binaries directory : C:\php\pear 5. PHP code directory ($php_dir) : C:\php\pear\pear 6. Documentation directory : C:\php\pear\docs 7. Data directory : C:\php\pear\data 8. User-modifiable configuration files directory : C:\php\pear\cfg 9. Public Web Files directory : C:\php\pear\www 10. Tests directory : C:\php\pear\tests 11. Name of configuration file : C:\Windows\pear.ini 12. Path to CLI php.exe : C:\php 1-12, 'all' or Enter to continue: Beginning install... PEAR_Config::writeConfigFile fopen('C:\Windows\pear.ini','w') failed (fopen(C:\W indows\pear.ini): failed to open stream: Permission denied)
C:\Windows\pear.ini に書き込めないよ!というエラー。
よく見ると、
これだけWindowsディレクトリに書きこむようになっている。これをPHPのインストールディレクトリに変更した。
C:\php\pear>php go-pear.phar Are you installing a system-wide PEAR or a local copy? (system|local) [system] : Below is a suggested file layout for your new PEAR installation. To change individual locations, type the number in front of the directory. Type 'all' to change all of them or simply press Enter to accept these locations. 1. Installation base ($prefix) : C:\php\pear 2. Temporary directory for processing : C:\php\pear\tmp 3. Temporary directory for downloads : C:\php\pear\tmp 4. Binaries directory : C:\php\pear 5. PHP code directory ($php_dir) : C:\php\pear\pear 6. Documentation directory : C:\php\pear\docs 7. Data directory : C:\php\pear\data 8. User-modifiable configuration files directory : C:\php\pear\cfg 9. Public Web Files directory : C:\php\pear\www 10. Tests directory : C:\php\pear\tests 11. Name of configuration file : C:\Windows\pear.ini 12. Path to CLI php.exe : C:\php 1-12, 'all' or Enter to continue: 11 # 11でEnter (Use $prefix as a shortcut for 'C:\php\pear', etc.) Name of configuration file [C:\Windows\pear.ini] : C:\php\pear.ini # 別の場所を指定
Below is a suggested file layout for your new PEAR installation. To change individual locations, type the number in front of the directory. Type 'all' to change all of them or simply press Enter to accept these locations. 1. Installation base ($prefix) : C:\php\pear 2. Temporary directory for processing : C:\php\pear\tmp 3. Temporary directory for downloads : C:\php\pear\tmp 4. Binaries directory : C:\php\pear 5. PHP code directory ($php_dir) : C:\php\pear\pear 6. Documentation directory : C:\php\pear\docs 7. Data directory : C:\php\pear\data 8. User-modifiable configuration files directory : C:\php\pear\cfg 9. Public Web Files directory : C:\php\pear\www 10. Tests directory : C:\php\pear\tests 11. Name of configuration file : C:\php\pear.ini 12. Path to CLI php.exe : C:\php 1-12, 'all' or Enter to continue: Beginning install... Configuration written to C:\php\pear.ini... Initialized registry... Preparing to install... installing phar://C:/php/pear/go-pear.phar/PEAR/go-pear-tarballs/Archive_Tar-1.3 .7.tar... installing phar://C:/php/pear/go-pear.phar/PEAR/go-pear-tarballs/Console_Getopt- 1.3.0.tar... installing phar://C:/php/pear/go-pear.phar/PEAR/go-pear-tarballs/PEAR-1.9.4.tar. .. installing phar://C:/php/pear/go-pear.phar/PEAR/go-pear-tarballs/Structures_Grap h-1.0.4.tar... installing phar://C:/php/pear/go-pear.phar/PEAR/go-pear-tarballs/XML_Util-1.2.1. tar... install ok: channel://pear.php.net/Archive_Tar-1.3.7 install ok: channel://pear.php.net/Console_Getopt-1.3.0 install ok: channel://pear.php.net/Structures_Graph-1.0.4 install ok: channel://pear.php.net/XML_Util-1.2.1 install ok: channel://pear.php.net/PEAR-1.9.4 PEAR: Optional feature webinstaller available (PEAR's web-based installer) PEAR: Optional feature gtkinstaller available (PEAR's PHP-GTK-based installer) PEAR: Optional feature gtk2installer available (PEAR's PHP-GTK2-based installer) PEAR: To install optional features use "pear install pear/PEAR#featurename" ****************************************************************************** WARNING! The include_path defined in the currently used php.ini does not contain the PEAR PHP directory you just specified: <C:\php\pear\pear> If the specified directory is also not in the include_path used by your scripts, you will have problems getting any PEAR packages working. Would you like to alter php.ini <C:\php\php.ini>? [Y/n] : y # php.iniの変更の同意を求められるので「Y」 php.ini <C:\php\php.ini> include_path updated. Current include path : .;c:\php\includes Configured directory : C:\php\pear\pear Currently used php.ini (guess) : C:\php\php.ini Press Enter to continue: ** WARNING! Old version found at C:\php\pear, please remove it or be sure to use the new c:\php\pear\pear.bat command The 'pear' command is now at your service at c:\php\pear\pear.bat ** The 'pear' command is not currently in your PATH, so you need to ** use 'c:\php\pear\pear.bat' until you have added ** 'C:\php\pear' to your PATH environment variable. Run it without parameters to see the available actions, try 'pear list' to see what packages are installed, or 'pear help' for help. For more information about PEAR, see: http://pear.php.net/faq.php http://pear.php.net/manual/ Thanks for using go-pear! * WINDOWS ENVIRONMENT VARIABLES * For convenience, a REG file is available under C:\php\pearPEAR_ENV.reg . This file creates ENV variables for the current user. Double-click this file to add it to the current user registry.
これで完了。