CentOS6.x compile and install LAMP (4): compile and install PHP5.2.17

Source: Internet
Author: User
Tags bz2 ftp gettext install php soap openssl pear zip

1. Install the PHP dependency Library

The code is as follows: Copy code

# Install libmcrypt

Cd/usr/local/src/php-lib/libmcrypt-2.5.8

./Configure -- prefix =/usr

Make & make install

# Install mhash

Cd/usr/local/src/php-lib/mhash-0.9.9.9

./Configure -- prefix =/usr

Make & make install

# Install mcrypt

/Sbin/ldconfig # search for a shared dynamic link library

Cd/usr/local/src/php-lib/mcrypt-2.6.8

./Configure

Make & make install

# Install libiconv

Cd/usr/local/src/php-lib/libiconv-1.14

./Configure -- prefix =/usr/local/libiconv

Make & make install

2. Install PHP 5.2.17

The code is as follows: Copy code

Cd/usr/local/src/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 -- enable-bcmath -- with-bz2 -- with-gd -- enable-gd-native-ttf -- with-gettext -- with-mhash -- enable-mbstring -- with-mcrypt -- enable-zip -- with-iconv =/usr/local/libiconv -- with-curl -- enable-soap -- enable-sockets -- enable-ftp -- with-mysql =/ usr/local/mysql -- with-pdo-mysql =/usr/local/mysql -- without-pear

Compilation parameter explanation:

-- Prefix =/usr/local/php: Set the installation path.
-- With-apxs2 =/usr/local/apache/bin/apxs: compile the shared Apache 2.0 Module
-- With-config-file-path =/etc: specifies the php. ini address of the configuration file.
-- With-config-file-scan-dir =/etc/php. d: specify an additional INI file directory.
-- With-openssl: OpenSSL compilation support
-- With-zlib: zlib compilation support
-- Enable-bcmath: enables the BC style precision mathematical function.
-- With-bz2: BZip2 support
-- With-gd: GD supported
-- Enable-gd-native-ttf: enable the TrueType string function.
-- With-gettext: Supports GNU gettext.
-- With-mhash: mhash supported
-- Enable-mbstring: enable multi-byte string
-- With-mcrypt: supports compiling mcrypt encryption
-- Enable-zip: enable zip read/write support
-- With-iconv =/usr/local/libiconv: iconv supported
-- With-curl: supported by CRUL
-- Enable-soap: SOAP support
-- Enable-sockets: supported by SOCKETS
-- Enable-ftp: FTP support
-- With-mysql =/usr/local/mysql: mysql support enabled
-- With-pdo-mysql =/usr/local/mysql: enables support for pdo-mysql
-- Without-pear: Do not install PEAR

For more compilation parameter explanations, see http://www.php.net/manual/zh/configure.about.php or./configure -- help.

# Copy the configuration file php. ini

The code is as follows: Copy code

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

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

Addtype application/x-httpd-php. php

3. Restart Apache

The code is as follows: Copy code

Service httpd restart # or/etc/init. d/httpd restart

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.