วันนี้มาทำงานที่ คณะเภสัชศาสตร์ มหาวิทยาลัยศิลปากร เป็นวันแรก ซึ่งผมยังไม่มีโต๊ะทำงาน ทำให้ยังไม่มีอะไรทำ ก็เลยยืมเครื่องโน๊ตบุ๊คของน้องมาใช้งานแก้เบื่อ สิ่งที่ทำวันนี้ก็ลง AppServ 2.5.10 และต้องการใช้งาน PEAR ด้วย ดังนั้นผมจึงต้องติดตั้งมัน (เคยเขียน Install PEAR in Mac OS X Leopard ไปแล้ว) วิธีติดตั้งก็ไม่ยาก คือ
1. เปิด Command Prompt ขึ้นมา (หรือจะใช้ทางลัดคือ Windows logo + R แล้วพิมพ์ cmd) จากนั้นพิมพ์คำสั่ง ดังนี้
cd c:\AppServ\php5 go-pear.bat
จากนั้นมันจะขึ้นข้อความดังข้างล่าง ก็ให้กด Enter ผ่านไป
Are you installing a system-wide PEAR or a local copy? (system|local) [system] :
ต่อไปจะมีข้อความดังข้างล่าง ก็ให้กด Enter ผ่านไปเช่นกัน
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:\AppServ\php5 2. Temporary directory for processing : C:\AppServ\php5\tmp 3. Temporary directory for downloads : C:\AppServ\php5\tmp 4. Binaries directory : C:\AppServ\php5 5. PHP code directory ($php_dir) : C:\AppServ\php5\pear 6. Documentation directory : C:\AppServ\php5\docs 7. Data directory : C:\AppServ\php5\data 8. User-modifiable configuration files directory : C:\AppServ\php5\cfg 9. Public Web Files directory : C:\AppServ\php5\www 10. Tests directory : C:\AppServ\php5\tests 11. Name of configuration file : C:\Windows\pear.ini 12. Path to CLI php.exe : C:\AppServ\php5\. 1-12, 'all' or Enter to continue:
จากนั้นจะมีข้อความแบบด้านล่าง ก็จะเสร็จขั้นตอนการติดตั้ง แต่ยังใช้คำสั่ง pear ไม่ได้
Beginning install... Configuration written to C:\Windows\pear.ini... Initialized registry... Preparing to install... installing phar://go-pear.phar/PEAR/go-pear-tarballs/Archive_Tar-1.3.2.tar... installing phar://go-pear.phar/PEAR/go-pear-tarballs/Console_Getopt-1.2.3.tar... installing phar://go-pear.phar/PEAR/go-pear-tarballs/PEAR-1.7.1.tar... installing phar://go-pear.phar/PEAR/go-pear-tarballs/Structures_Graph-1.0.2.tar. .. pear/PEAR can optionally use package "pear/XML_RPC" (version >= 1.4.0) install ok: channel://pear.php.net/Archive_Tar-1.3.2 install ok: channel://pear.php.net/Console_Getopt-1.2.3 install ok: channel://pear.php.net/Structures_Graph-1.0.2 install ok: channel://pear.php.net/PEAR-1.7.1 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! Old version found at C:\AppServ\php5, please remove it or be sure to use the new c:\appserv\php5\pear.bat command The 'pear' command is now at your service at c:\appserv\php5\pear.bat * WINDOWS ENVIRONMENT VARIABLES * For convenience, a REG file is available under C:\AppServ\php5\PEAR_ENV.reg . This file creates ENV variables for the current user. Double-click this file to add it to the current user registry. Press any key to continue . . .
2. เมื่อติดตั้งเสร็จแล้วจะต้องรันไฟล์ PEAR_ENV.reg ด้วย เพื่อตั้งค่าต่างๆ ที่ต้องใช้ โดดับเบิ้ลคลิกไฟล์ที่ C:\AppServ\php5\PEAR_ENV.reg เมื่อเสร็จแล้วก็สามารถใช้คำสั่ง pear ได้
หมายเหตุ สำหรับผู้ใช้งานเน็ตเวิร์กที่ต้องใช้ proxy โดยสามารถตั้งค่าได้ โดยใช้คำสั่งนี้
pear config-set http_proxy http://username:password@proxy:portเพียงเท่านี้ก็สามารถใช้งาน PEAR ได้สบายใจซะที :D


