Configure php5.3 in Linux

Source: Internet
Author: User

1. First, modify the yum source to a 163 source to increase the speed.

2. Update Yum first:

 
1Yum-y update

3. Use Yum to installProgramAnd Library

 
Yum-y install GCC gcc-C ++ Autoconf libjpeg-devel libpng-devel FreeType-devel libxml2 libxml2-devel zlib-devel glibc-devel glib2 glib2-devel Bzip2 bzip2-devel ncurses- devel curl-devel e2fsprogs e2fsprogs-devel krb5 krb5-devel libidn-devel OpenSSL-devel OpenLDAP openldap-devel nss_ldap openldap-clients openldap-servers
 
Yum-y install libevent-devel
 
Yum install libc-client-devel

4. download and install the required Program
Use the wget command to download the following files to CD/usr/src /.
Wget http://nginx.org/download/nginx-0.8.52.tar.gz
Wget http://cn.php.net/get/php-5.3.3.tar.gz/from/this/mirror
Wget http://dev.mysql.com/get/Downloads/MySQL-5.5/mysql-5.5.6-rc.tar.gz/from/http://mysql.he.net/
Wget http://memcached.googlecode.com/files/memcached-1.4.5.tar.gz
Wget http://ftp.gnu.org/pub/gnu/libiconv/libiconv-1.13.1.tar.gz
Wget http://downloads.sourceforge.net/project/mcrypt/MCrypt/2.6.8/mcrypt-2.6.8.tar.gz? Use_mirror = NCU
Wget http://downloads.sourceforge.net/project/mcrypt/Libmcrypt/2.5.8/libmcrypt-2.5.8.tar.gz? Use_mirror = NCU
Wget http://downloads.sourceforge.net/project/mhash/mhash/0.9.9.9/mhash-0.9.9.9.tar.gz? Use_mirror = NCU
Wget http://downloads.sourceforge.net/project/pcre/pcre/8.10/pcre-8.10.tar.gz? Use_mirror = NCU
Wget http://downloads.sourceforge.net/project/imagemagick/ImageMagick/00-6.6.5/ImageMagick-6.6.5-0.tar.gz? Use_mirror = NCU
Wget http://pecl.php.net/get/APC-3.1.4.tgz
Wget http://pecl.php.net/get/memcache-2.2.6.tgz
Wget http://pecl.php.net/get/imagick-3.0.1RC2.tgz

5. install the software downloaded above:
① Install libiconv:

 
Tar zxvf libiconv-1.13.1.tar.gz
CDLibiconv-1.13.1/
./Configure -- prefix =/usr/local/libiconv
Make
Make install

② Modify the Directory Search file loaded by the dynamic link

 
VI/etc/lD. So. conf

Add/usr/local/lib at the end of the file, and then run the following command

 
/Sbin/ldconfig

③ Install libmcrypt

./Configure
Make
Make install
/Sbin/ldconfig
CDLibltdl/
./Configure -- enable-ltdl-install
Make
Make instal

④ Install mhash

 
./Configure
Make
Make install
CD../
Ln-S/usr/local/bin/libmcrypt-config/usr/bin/libmcrypt-config

⑤ Install mcrypt

 
CDMcrypt-2.6.8/
/Sbin/ldconfig
./Configure
Make
Make install

⑥ Install memcached

 
CDMemcached-1.4.5
./Configure -- prefix =/usr/local/memcached
Make
Make install

7. Install PCRE

 
CDPcre-8.10/
./Configure
Make
Make install

6. Configure PHP

. /Configure -- prefix =/usr/local/PHP -- with-apxs2 =/usr/local/Apache/bin/apxs -- With-libxml-Dir =/usr/lib/libxml2.so. 2.7.6 -- With-mysql =/usr/include/MySQL/-- With-config-file-Path =/usr/local/PHP -- With-iconv =/usr/local/libiconv/ -- With-mysql = mysqlnd -- With-mysqli = mysqlnd -- With-PDO-mysql = mysqlnd -- With-zlib -- with-IBM_DB2 =/home/db2inst1/sqllib/include -- enable-sockets -- Enable-FTP-- With-LDAP [= dir]-- With-LDAP-sasl [= dir] memcache memcached

Note:
-- With-mysql = mysqlnd -- With-mysqli = mysqlnd -- With-PDO-mysql = mysqlnd. In this way, MySQL, mysqli, and PdO MySQL use mysqlnd. (After mysqlnd is used, you need to use mysqladmin to reset the MySQL password: mysqladmin-u root-P password.
If the prompt cannot find MySQL header file under... is prompted during PHP configuration, because the mysql. h file is not found, install the MySQL-devel-version.rpm, either in/usr/include/MySQL
After successful configuration, make and make install are supported.
If configure: Error: Try adding -- With-zlib-Dir = <dir>. is displayed, add -- With-zlib at the end of the configuration.
If the following error occurs: MySQL configure failed, change -- With-MYSQL to -- With-mysql-Dir.

Add DB2 extension:

 
-- With-IBM_DB2 =/home/db2inst2/sqllib/include

Alternatively, you can directly use the pear command to install the extension. Pear is in the bin folder under the PHP installation directory:

 
PECL install ibm_db2 enter the DB2 installation directory as prompted, for example:/opt/IBM/DB2/v10.1


supplement:
after installing PHP, if you want to append other extensions, such as : mcrypt, decompress the package to the PHP source code folder. In Ext, integrate most of the package to the extension components. Go to the EXT/ mcrypt directory and run the following command:
/usr/local/PHP/bin/phpize
. /configure -- With-PHP-Config =/usr/local/PHP/bin/PHP-config
make install
after installation, modify PHP. INI file to add the mcrypt Extension: Extension = mcrypt. so
6. Modify the Apache configuration file
in the Apache configuration file httpd. add
loadmodule php5_module modules/libphp5.so
addtype application/X-httpd-PHP in Conf. php
attaches index to directoryindex. php
7. install PHP in the PHP installation directory. copy ini-development to the directory specified when you configure the PHP file, that is: with-config-file-Path =/usr/local/PhP5 specified/usr/local/PhP5 directory, and renamed it PHP. INI

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.