PHP Several common extensions for installation use

Source: Internet
Author: User

Recently because of the reason for the work of the need to build a development environment, the deployment of code to find that many of the PHP extensions are not installed, I will be based on the error message step-by-Step installation of some extensions

PHP can be compiled in PHP when the corresponding extension, can also be compiled in the future, in the actual application of most of the expansion is followed by the addition of a compilation with so many--with-also difficult to handle, the subsequent addition of the compiler extension when PHP provides us with the Phpize tool

PHP's most of the expansion of the source code under the PHP source under the corresponding directory under Ext. For example: Php-5.3.8/ext/curl the source files needed to install Curl extensions when stored below

First, PDO expansion

Pod extension is added in PHP5, which provides PHP built-in class PDO to access the database, and different databases use the same method name to solve the problem of the database connection is not unified.
PDO's goal

Provides a lightweight, clear, and convenient API
Unifies the common characteristics of various RDBMS libraries, but does not exclude more advanced features.
Provides an optional degree of abstraction/compatibility through PHP scripts.

Installation PDO expansion is relatively simple

CD Php-5.3.8/ext/pdo_mysql

/usr/loca/php/bin/phpize

./configure--with-php-config=/usr/local/php/bin/php-config

Make && make install

After the compilation completes, a. So file is generated, open php.ini file add extension restart service Extension_dir = "/usr/local/php/lib/php/extensions/ no-debug-non-zts-20090626/"This path has been eventually compiled to generate the path that is quasi

Extension=curl.so

Second, memcache expansion

A problem was encountered when installing the extension, memcache and memcached

1. Most of the current PHP environment is used without D memcache version, this version of the earlier, is a native version, fully developed within the PHP framework.
The corresponding memcached with D is based on libmemcached, so the memcached version is more functional in comparison.
memcache:http://cn2.php.net/manual/en/book.memcache.php
memcached:http://cn2.php.net/manual/en/book.memcached.php
2.Memcache is a native implementation that supports OO and non-oo two sets of interfaces. And memcached is using libmemcached to support only OO interfaces.
3.memcached also has a very commendable place, is flag not in the operation time set, but has a unified setoption (). Memcached has implemented more memcached protocols.
4.memcached supports binary Protocol, while Memcache does not support it. This means that memcached will have a higher performance. However, Memcached currently does not support long connections.
Installation Memcache is relatively simple

Install Memcache Service

1). Download Libevent & memcached Source Pack
Libevent-1.3.tar.gz
Memcached-1.2.2.tar.gz


2). Decompress libevent-1.3.tar.gz, compile and install
# tar ZXVF libevent-1.3.tar.gz
# CD libevent-1.3
#./configure--prefix=/usr/local/libevent
# make; Make install

3) Installation Memcache
# tar ZXVF memcached-1.2.2.tar.gz
# CD memcached-1.2.2
#./configure--prefix=/usr/local/memchached--with-libevent=/usr/local/libevent
# Make;make Install

Test Memcache service is normal

/usr/local/memcached/bin/memcached-d-M 256-p 11211-u Root

4) Install PHP extension

# tar zxf memcache-2.2.3.tgz
# CD memcache-2.2.3
#/usr/local/servers/php5/bin/phpize
#./configure--enable-memcache=/usr/local/servers/memcached--with-php-config=/usr/local/servers/php5/bin/ Php-config
# Make && make install

Installing memcached Extensions

This step can see the http://techbbs.zol.com.cn/1/9_3174_uid_popslay.html, here to say more detail


Third, the installation of MCrypt extension

PHP programmers in writing code programs, in addition to ensure the high performance of the code, but also is very important, that is, the security of the program. In addition to the several encryption functions, PHP has a more full-featured PHP encryption extension Library MCrypt and Mhash.
Among them, the MCrypt extension Library can achieve encryption and decryption function, that is, both plaintext can be encrypted or ciphertext can be restored. PHP encryption extension Library MCrypt algorithm and encryption mode
The MCrypt library supports more than 20 encryption algorithms and 8 encryption modes, which can be displayed by function mcrypt_list_algorithms () and Mcrypt_list_modes (), and the results are as follows:
Mcrypt supported algorithms are: cast-128 gost rijndael-128 twofish arcfour cast-256 loki97-rijndael-192 saferplus wake Blowfish-compat des R ijndael-256 Serpent Xtea Blowfish Enigma RC2
The encryption modes supported by MCrypt are: CBC CFB Ctr ECB NCFB NOFB OFB stream
These algorithms and patterns in the application to be expressed in Changshilai, write with the prefix Mcrypt_ and Mcrypt_ to express, as the following mcrypt application examples:
DES algorithm is expressed as mcrypt_des;
ECB model is expressed as MCRYPT_MODE_ECB;

First download three software, respectively
Libmcrypt-2.5.8.tar.gz
Mhash-0.9.9.tar.gz

Mcrypt-2.6.8.tar.gz

Install number Libmcrypt and Mhash before installing MCrypt

# TAR-XVF Libmcrypt-x.x.x.tar
# CD libmcrypt-x.x.x
#./configure

# TAR-XVF Mhash-x.x.x.tar
# CD mhash-x.x.x
#./configure

# Ldconfig

#tar-XVF Mcrypt.x.x.xtar

#cd MCrypt

#./configure--prefix=/usr/loca/mcrypt

Make && make install

CD Php/ext/mcrypt

Phpize

./configure--with-mcrypt=/usr/local/mcrypt--with-php-config=/usr/local/php/bin/php-config

Make && make install

Ways to extend the installation there are a lot of online, these several I follow this step test is feasible, of course, Linux installation software under the various dependency package is already very complex, the version of the impassability may need to install some other





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.