Installing Pear and DB_DataObject

Posted by PunNeng, Wed Dec 07 23:18:00 UTC 2005

NOTICE: post นี้ ข้อมูลเก่าครับ ของใหม่ดีกว่า ว่ากันง่ายๆ เลย ผมขี้เกียจแก้ละ :)

มาที่การติดตั้งกัน ผมจะติดตั้งบน appserv บน Windows นะครับ ถ้ายังไม่มีก็ download หลังจากติดตั้ง appserv กันเสร็จเรียบร้อยแล้ว เริ่มเลยยย

เปิด http://go-pear.org/ จะเห็นว่าเป็น code php แล้ว save ทั้งหมดเป็น go-pear.php ไว้ใน php folder

นั้นแหละ จากนั้น เปิดหน้า dos ขึ้นมา เข้าไปใน php folder แล้วพิมพ์ว่า

php go-pear.php
มันจะมีตัวเลือกอยู่ ให้เลือกข้อ 7 แล้วใส่ path ของ php ลงไป แล้วทำตามขั้นตอนต่อไป ในหน้า dos ทั้งหมดตังแต่แรก จะขึ้นว่า
D:\appserv\php>php go-pear.php
Content-type: text/html
X-Powered-By: PHP/4.3.11

Welcome to go-pear!

Go-pear will install the 'pear' command and all the files needed by
it.  This command is your tool for PEAR installation and 
maintenance.

Use 'php  local' to install a local copy of PEAR.

Go-pear also lets you download and install the PEAR packages bundled
with PHP: DB, Net_Socket, Net_SMTP, Mail, XML_Parser, PHPUnit.


If you wish to abort, press Control-C now, or press Enter to continue:

HTTP proxy (http://user:password@proxy.myhost.com:port), or Enter for none::

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 prefix           : D:\appserv\php
 2. Binaries directory            : $prefix
 3. PHP code directory ($php_dir) : $prefix\pear
 4. Documentation base directory  : $php_dir\docs
 5. Data base directory           : $php_dir\data
 6. Tests base directory          : $php_dir\tests
 7. php.exe path                  : 

1-7, 'all' or Enter to continue: 7
php.exe path [] : d:\appserv\php

********************************************************
NOTICE! We found php.exe under d:/appserv/php\php.exe, it uses a cgi SAPI.
PEAR commandline tool works well with it.
If you have a CLI php.exe available, we recommand to use it.

php.exe (sapi: cgi) found.


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 prefix           : D:\appserv\php
 2. Binaries directory            : $prefix
 3. PHP code directory ($php_dir) : $prefix\pear
 4. Documentation base directory  : $php_dir\docs
 5. Data base directory           : $php_dir\data
 6. Tests base directory          : $php_dir\tests
 7. php.exe path                  : d:\appserv\php\php.exe

1-7, 'all' or Enter to continue:

The following PEAR packages are bundled with PHP: DB, Net_Socket, Net_SMTP,
Mail, XML_Parser, PHPUnit.
Would you like to install these as well? [Y/n] : y

Loading zlib: ok
Downloading package: PEAR-stable......ok
Downloading package: Archive_Tar-stable....ok
Downloading package: Console_Getopt-stable....ok
Downloading package: XML_RPC-stable....ok
Bootstrapping: PEAR...................(remote) ok
Bootstrapping: Archive_Tar............(remote) ok
Bootstrapping: Console_Getopt.........(remote) ok
Downloading package: DB...............ok
Downloading package: Net_Socket.......ok
Downloading package: Net_SMTP.........ok
Downloading package: Mail.............ok
Downloading package: XML_Parser.......ok
Downloading package: PHPUnit..........ok
Extracting installer..................ok
WARNING: channel "pear.php.net" has updated its protocols, use "channel-update p
ear.php.net" to update
warning: pear/PEAR requires package "pear/Archive_Tar" (version >= 1.3.1)
warning: pear/PEAR requires package "pear/Console_Getopt" (version >= 1.2)
pear/PEAR can optionally use package "pear/XML_RPC" (version >= 1.4.0)
pear/PEAR can optionally use package "pear/PEAR_Frontend_Web" (version >= 0.5.0)

pear/PEAR can optionally use package "pear/PEAR_Frontend_Gtk" (version >= 0.4.0)

install ok: channel://pear.php.net/PEAR-1.4.5
WARNING: channel "pear.php.net" has updated its protocols, use "channel-update p
ear.php.net" to update
install ok: channel://pear.php.net/Archive_Tar-1.3.1
WARNING: channel "pear.php.net" has updated its protocols, use "channel-update p
ear.php.net" to update
install ok: channel://pear.php.net/Console_Getopt-1.2
WARNING: channel "pear.php.net" has updated its protocols, use "channel-update p
ear.php.net" to update
install ok: channel://pear.php.net/XML_RPC-1.4.4
WARNING: channel "pear.php.net" has updated its protocols, use "channel-update p
ear.php.net" to update
install ok: channel://pear.php.net/DB-1.7.6
WARNING: channel "pear.php.net" has updated its protocols, use "channel-update p
ear.php.net" to update
install ok: channel://pear.php.net/Net_Socket-1.0.6
WARNING: channel "pear.php.net" has updated its protocols, use "channel-update p
ear.php.net" to update
pear/Net_SMTP can optionally use package "pear/Auth_SASL"
install ok: channel://pear.php.net/Net_SMTP-1.2.7
WARNING: channel "pear.php.net" has updated its protocols, use "channel-update p
ear.php.net" to update
install ok: channel://pear.php.net/Mail-1.1.9
WARNING: channel "pear.php.net" has updated its protocols, use "channel-update p
ear.php.net" to update
install ok: channel://pear.php.net/XML_Parser-1.2.7
WARNING: channel "pear.php.net" has updated its protocols, use "channel-update p
ear.php.net" to update
pear/PHPUnit can optionally use package "pear/PHP_Compat"
install ok: channel://pear.php.net/PHPUnit-1.3.2

*******************************************************
WARNING!  The include_path defined in the currently used php.ini does not
contain the PEAR PHP directory you just specified:

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 ? [Y/n] : y

php.ini  include_path updated.

Current include path           : .;c:\php4\pear
Configured directory           : D:\appserv\php\pear
Currently used php.ini (guess) : C:\WINDOWS\php.ini
Press Enter to continue:

The 'pear' command is now at your service at d:\appserv\php\pear.bat

** The 'pear' command is not currently in your PATH, so you need to
** use 'd:\appserv\php\pear.bat' until you have added
** 'D:\appserv\php' 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://cvs.php.net/co.php/pearweb/doc/pear_package_manager.txt?p=1
  http://pear.php.net/manual/

Thanks for using go-pear!



* WINDOWS ENVIRONMENT VARIABLES *
For convenience, a REG file is available under D:\appserv\php\PEAR_ENV.reg .
This file creates ENV variables for the current user.

Double-click this file to add it to the current user registry.


D:\appserv\php>
หลังจากเสร็จแล้ว เราจะได้ PEAR_ENV.reg เป็นตัว set environment variable แล้วก็ double click ที่ไฟล์นี้เลย เท่านี้ก็เป็นการเสร็จสิ้นการติดตั้ง PEAR แล้ว ต่อไปจะเป็นการติดตั้ง DB_DataObject นะครับ ยังอยู่กันที่หน้า dos ใน php folder นะ เราจะพิมพ์ต่อว่า
pecl install http://www.pear.php.net/get/DB_DataObject-1.7.15.tgz
แล้วมันจะเตือนเราว่า ต้องติดตั้ง Data ก่อน ก็พิมพ์ว่า
pecl install http://www.pear.php.net/get/Date-1.4.6.tgz
พอเสร็จแล้ว ก็ย้อนกลับไปติดตั้ง DB_DataObject-1.7.15.tgz ใหม่ ในหน้า dos ควรจะขึ้นว่า
D:\appserv\php>pecl install http://www.pear.php.net/get
/Date-1.4.6.tgz
downloading Date-1.4.6.tgz ...
Starting to download Date-1.4.6.tgz (53,535 bytes)
.............done: 53,535 bytes
WARNING: channel "pear.php.net" has updated its protocols, use "channel-update p
ear.php.net" to update
install ok: channel://pear.php.net/Date-1.4.6

D:\appserv\php>pecl install http://www.pear.php.net/get
/DB_DataObject-1.7.15.tgz

downloading DB_DataObject-1.7.15.tgz ...
Starting to download DB_DataObject-1.7.15.tgz (51,854 bytes)
.............done: 51,854 bytes
WARNING: channel "pear.php.net" has updated its protocols, use "channel-update p
ear.php.net" to update
Did not download dependencies: pear/Validate, use --alldeps or --onlyreqdeps to
download automatically
pear/DB_DataObject can optionally use package "pear/Validate" (version >= 0.1.1)

install ok: channel://pear.php.net/DB_DataObject-1.7.15

เท่านี้ก็เสร็จสิ้นการติดตั้ง

คราวหน้าจะเป็น tutorial ครับ จะดึงข้อมูลใน Database น้อยๆ ของเรา ขึ้นมาแสดง

ปล. อันนี้เป็นการติดตั้งในขณะที่เราต่อ internet อยู่ ถ้าเราจะ download package มา แล้วไปติดตั้งที่อื่น ก็ได้ มี command คอยสั่งอยู่ครับ

แก้ไขล่าสุด วันที่ 28 มิถุนายน 2550 เวลา 2.12 น.

ข้อมูลจาก
link เก่าไม่อยู่แล้ว link ใหม่อยู่ข้างบน

Filed Under: General | Tags: db dataobject howto installing orm pear php

Comments

  1. แอร์ 05.05.08 / 14PM

    ขอบคุณครับ

Have your say

A name is required. You may use HTML in your comments.




codegent: we're hiring