php 확장 라이브러리 설치(pear)
pear(Extension and Application Repository)은 php 소스코드에 include 해서 사용가능한, php코드로 쓰여진 클래스 repository
php/lib/php/ 디렉토리에 해당 라이브러리가 추가 된다.
1. 설치되어있는 클래스(라이브러리) 목록 출력
[root@localhost bin]# cd /usr/local/php/bin
[root@localhost bin]# ./pear list
Installed packages, channel pear.php.net:
=========================================
Package Version State
Archive_Tar 1.3.7 stable
Console_Getopt 1.2.3 stable
HTTP_Request 1.4.4 stable
Net_Socket 1.0.10 stable
Net_URL 1.0.15 stable
PEAR 1.9.1 stable
Structures_Graph 1.0.3 stable
XML_Util 1.2.1 stable
2. 클래스(라이브러리) 설치
[root@localhost bin]# ./pear install http_request
WARNING: “pear/HTTP_Request” is deprecated in favor of “pear/HTTP_Request2”
WARNING: “pear/Net_URL” is deprecated in favor of “pear/Net_URL2”
downloading HTTP_Request-1.4.4.tgz …
Starting to download HTTP_Request-1.4.4.tgz (17,109 bytes)
……done: 17,109 bytes
downloading Net_URL-1.0.15.tgz …
Starting to download Net_URL-1.0.15.tgz (6,303 bytes)
…done: 6,303 bytes
downloading Net_Socket-1.0.10.tgz …
Starting to download Net_Socket-1.0.10.tgz (5,429 bytes)
…done: 5,429 bytes
install ok: channel://pear.php.net/Net_URL-1.0.15
install ok: channel://pear.php.net/Net_Socket-1.0.10
install ok: channel://pear.php.net/HTTP_Request-1.4.4
[root@localhost bin]# ./pear install HTTP_Session
Failed to download pear/HTTP_Session within preferred state “stable”, latest release is version 0.5.6, stability “beta”, use “channel://pear.php.net/HTTP_Session-0.5.6” to install
install failed
[root@localhost bin]# ./pear install HTTP_Session-0.5.6
WARNING: “pear/HTTP_Session” is deprecated in favor of “pear/HTTP_Session2”
WARNING: “pear/DB” is deprecated in favor of “pear/MDB2”
WARNING: “pear/MDB” is deprecated in favor of “pear/MDB2”
Did not download optional dependencies: pear/DB, pear/MDB, pear/MDB2, use –alldeps to download automatically
pear/HTTP_Session can optionally use package “pear/DB” (version >= 1.7.6)
pear/HTTP_Session can optionally use package “pear/MDB” (version >= 1.1.4)
pear/HTTP_Session can optionally use package “pear/MDB2” (version >= 2.0.1)
downloading HTTP_Session-0.5.6.tgz …
Starting to download HTTP_Session-0.5.6.tgz (15,343 bytes)
…..done: 15,343 bytes
install ok: channel://pear.php.net/HTTP_Session-0.5.6
3. 설치 가능한 리스트 목록
[root@localhost bin]# ./pear list-all
All packages [Channel pear.php.net]:
====================================
Package Latest Local
pear/Auth_HTTP 2.1.8 HTTP authentication
pear/Auth 1.6.4 Creating an authentication system.
pear/Auth_SASL 1.0.6 Abstraction of various SASL mechanism responses
pear/LiveUser 0.16.14 User authentication and permission management framework
pear/Auth_PrefManager 1.2.2 Preferences management class
pear/Auth_RADIUS 1.0.7 Wrapper Classes for the RADIUS PECL.
pear/Auth_PrefManager2 2.0.0dev1 Preferences management class
pear/LiveUser_Admin 0.4.0 User authentication and permission management framework
pear/Auth_SASL2 0.1.0 Abstraction of various SASL mechanism responses.
Rewritten to take advantage of PHP5 style & syntax
pear/OpenID 0.3.3 PHP implementation of OpenID 1.1 and 2.0
pear/Benchmark 1.2.9 Framework to benchmark PHP scripts or function calls.
~
[root@localhost bin]#
4. 설치된 라이브러리 확인
– 추가한 라이브러리들은 /usr/local/php/lib/php 디렉토리내에 생성되며, php코드에 include 해서 사용 할 수 있다.
[root@localhost bin]# cd /usr/local/php/lib/php
[root@localhost php]# ls -al
total 160
drwxr-xr-x 16 root root 4096 Jan 17 09:08 .
drwxr-xr-x 3 root root 4096 Jun 4 2012 ..
drwxr-xr-x 3 root root 4096 Jun 4 2012 .channels
-rw-r–r– 1 root root 3765 Jan 17 09:15 .depdb
-rw-r–r– 1 root root 0 Jan 17 09:15 .depdblock
-rw-r–r– 1 root root 9445 Jan 17 09:15 .filemap
-rw-r–r– 1 root root 0 Jan 17 09:15 .lock
drwxr-xr-x 5 root root 4096 Jan 17 09:15 .registry
drwxr-xr-x 2 root root 4096 Jun 4 2012 Archive
drwxr-xr-x 2 root root 4096 Jun 4 2012 Console
drwxr-xr-x 4 root root 4096 Jan 17 09:15 HTTP
drwxr-xr-x 2 root root 4096 Jan 17 09:08 Net
drwxr-xr-x 2 root root 4096 Jun 4 2012 OS
drwxr-xr-x 11 root root 4096 Jun 4 2012 PEAR
-rw-r–r– 1 root root 33897 Jun 4 2012 PEAR.php
-rw-r–r– 1 root root 1087 Jun 4 2012 PEAR5.php
drwxr-xr-x 3 root root 4096 Jun 4 2012 Structures
-rw-r–r– 1 root root 19967 Jun 4 2012 System.php
drwxr-xr-x 2 root root 4096 Jun 4 2012 XML
drwxr-xr-x 2 root root 4096 Jun 4 2012 build
drwxr-xr-x 4 root root 4096 Jun 4 2012 data
drwxr-xr-x 9 root root 4096 Jan 17 09:15 doc
-rw-r–r– 1 root root 14393 Jun 4 2012 pearcmd.php
-rw-r–r– 1 root root 942 Jun 4 2012 peclcmd.php
drwxr-xr-x 5 root root 4096 Jan 17 09:15 test
[root@localhost php]# cd HTTP/
[root@localhost HTTP]# ls -l
total 88
drwxr-xr-x 2 root root 4096 Jan 17 09:08 Request
-rw-r–r– 1 root root 50523 Jan 17 09:08 Request.php
drwxr-xr-x 3 root root 4096 Jan 17 09:15 Session
-rw-r–r– 1 root root 23475 Jan 17 09:15 Session.php
[root@localhost HTTP]#