Configure PHP-JSON extension in RedHat and centos

Source: Internet
Author: User
Tags pear php source code

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.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.