Pear is the abbreviation of the PHP extension and application repository. It is a code repository for PHP extensions and applications. In short, pear is like CPAN (Comprehensive Perl archive network) to Perl in PHP.
PECL (PhP extension Community Library), PHP extension library, which provides a series of known extension libraries, compiled by C ++ and other languages, mostly DLL (Dynamic Link Library) it is faster than pear, but unlike pear, PECL needs to be configured on the server and registered to the host.
Existing PHP environment:
Required RPM package for PHP installation
# Rpm-AQ | grep PHP
Php-5.1.6-27.el5_5.3
Php-mysql-5.1.6-27.el5_5.3
Php-common-5.1.6-27.el5_5.3
Php-pdo-5.1.6-27.el5_5.3
Php-ldap-5.1.6-27.el5_5.3
Php-devel-5.1.6-27.el5_5.3
Php-xml-5.1.6-27.el5_5.3
Php-cli-5.1.6-27.el5_5.3
RPM package
Http://rpm.pbone.net
Http://rpmfind.net
Http://download.fedora.redhat.com/pub/epel/5/x86_64/
PHP source code
Http://jp.php.net/releases/index.php
Method 1:
Download the source code package:
Http://pecl.php.net/package/json
# Tar-xvf json-1.2.0.tgz
#/Usr/local/PHP/bin/PECL build
# Cd json-1.2.0
#./Configure
# Make
# Make install
Method 2:
Download source code package
Http://www.aurore.net/projects/php-json/php-json-ext-1.2.0.tar.bz2
Installation:
# Tar xvjf php-json-ext-1.2.0.tar.bz2
# Cd php-json-ext-1.2.0
#/Usr/bin/phpize
#./Configure
# Make
# Make install
Create a configuration file for JSON. ini
/Etc/PHP. d/JSON. ini
The content is as follows:
Extension = JSON. So
Restart Apache
#/Etc/init. d/httpd restart
Problems:
My machine has two PHP versions. One is RPM 5.1.6 (/usr/bin/PHP) and the other is source code 5.3.6 (/usr/local/PHP/bin/PHP)
I want to configure JSON extension for 5.1.6, but it is always installed in 5.3.6 environment?
The reason is: When configure is executed, the PHP-config command is called to generate the makefile, while the PATH value of the environment variable is/usr/local/bin:/usr/bin.
Therefore, every time makefile is generated,/usr/local/PHP/bin/PHP-config is called.
Solution: Change path to/usr/bin:/usr/local/bin.