CentOS6.3 Compile and install lamp (4): Compile and install PHP5.2.17

Source: Internet
Author: User
Tags gettext soap mcrypt pear phpinfo

The required source code package:

/usr/local/src/php-5.2.17/libmcrypt-2.5.8.tar.gz
/usr/local/src/php-5.2.17/mhash-0.9.9.9.tar.gz
/usr/local/src/php-5.2.17/mcrypt-2.6.8.tar.gz
/usr/local/src/php-5.2.17/libiconv-1.14.tar.gz
/usr/local/src/php-5.2.17/php-5.2.17.tar.gz

Before compiling PHP, there are two issues to solve:centos6.x on libmcrypt installation and some systems may not be able to find errors caused by Libiconv .

1. Install PHP Dependency Library

# Install Libmcrypt

CD/USR/LOCAL/SRC/PHP-5.2.17TAR-XZVF./libmcrypt-2.5.8.tar.gzcd./libmcrypt-2.5.8./configure--prefix=/usrmake && make Install

#安装 Mhash

CD/USR/LOCAL/SRC/PHP-5.2.17TAR-XZVF./mhash-0.9.9.9.tar.gzcd./mhash-0.9.9.9./configure--prefix=/usrmake & & Make Install

#安装 MCrypt

/sbin/ldconfig  #搜索出可共享的动态链接库cd/usr/local/src/php-5.2.17tar-xzvf./mcrypt-2.6.8.tar.gzcd./mcrypt-2.6.8./ Configuremake && make Install

#安装 Libiconv

CD/USR/LOCAL/SRC/PHP-5.2.17TAR-XZVF./libiconv-1.14.tar.gzcd./libiconv-1.14./configure--prefix=/usr/local/ Libiconvmake && make Install

2. Install PHP 5.2.17

cd/usr/local/src/php-5.2.17/php-5.2.17

#生成配置

./configure--prefix=/usr/local/php--with-apxs2=/usr/local/apache/bin/apxs--with-config-file-path=/etc-- WITH-CONFIG-FILE-SCAN-DIR=/ETC/PHP.D--with-openssl--with-zlib--with-bz2--with-gettext--with-mhash--with-mcrypt --with-iconv=/usr/local/libiconv--with-curl--with-gd--with-jpeg-dir--with-png-dir--with-freetype-dir-- With-mysql=/usr/local/mysql--with-pdo-mysql=/usr/local/mysql--enable-gd-native-ttf--enable-bcmath-- Enable-mbstring--enable-zip--enable-soap--enable-sockets--enable-ftp--without-pear

#编译

Make && make install

Explanation of compilation parameters:

--prefix=/usr/local/php: Setting the installation path
--WITH-APXS2=/USR/LOCAL/APACHE/BIN/APXS: Compiling the shared Apache 2.0 module
--WITH-CONFIG-FILE-PATH=/ETC: Specify profile php.ini Address
--WITH-CONFIG-FILE-SCAN-DIR=/ETC/PHP.D: Specify additional INI file directories
--WITH-OPENSSL: Compiling OpenSSL support
--with-zlib: Compiling zlib support
--enable-bcmath: Enable BC style precision math functions
--WITH-BZ2:BZIP2 Support
--WITH-GD:GD Support
--enable-gd-native-ttf: Enable TrueType String functions
--with-gettext: Enable GNU GetText support
--with-mhash:mhash Support
--enable-mbstring: Enable multi-byte string support
--with-mcrypt: Compiling MCrypt encryption support
--enable-zip: Enable zip read/write support
--with-iconv=/usr/local/libiconv:iconv Support
--with-curl:crul Support
--ENABLE-SOAP:SOAP Support
--enable-sockets:sockets Support
--ENABLE-FTP:FTP Support
--with-mysql=/usr/local/mysql: Enable MySQL support
--with-pdo-mysql=/usr/local/mysql: Enable Pdo-mysql support
--without-pear: Do not install pear

Additional compilation parameters are explained in the reference http://www.php.net/manual/zh/configure.about.php or ./configure--help view.

#复制配置文件php. ini

Cp/usr/local/src/php-5.2.17/php-5.2.17/php.ini-dist/usr/local/php/etc/php.ini

Add php file type Resolution #在/etc/httpd/conf/httpd.conf file (add to the end of the file)

AddType application/x-httpd-php. php

3. Restart Apache

Service httpd Restart  # or/ETC/INIT.D/HTTPD restart

Run the phpinfo () function with the following page information:

Http://blog.snsgou.com/1/phpinfo/phpinfo-5.2.17.htm

Extended reading:

centos6.x Compile and install lamp (1): Ready to work

centos6.x Compile and install lamp (2): Compile and install Apache2.2.25

centos6.x Compile and install lamp (2): Compile and install Apache2.4.6

centos6.x Compile and install lamp (3): Compile and install MySQL5.5.25

centos6.x Compile and install lamp (4): Compile and install PHP5.2.17

centos6.x Compile and install lamp (4): Compile and install PHP5.3.27

PHP5 do not recompile, how do I install a self-installed extension, such as a soap extension?

CentOS6.3 Compile and install lamp (4): Compile and install PHP5.2.17

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.