Build and install PHP5.6 under CentOS

Source: Internet
Author: User

Directory

    • 1 Installing PHP-dependent extensions
    • 2 Download Unzip PHP
    • 3 Compiling PHP
    • 4 Let Apache support PHP
    • 5 test Installation

To install PHP-dependent extensions:

1 Yum Install -y libxml2-devel openssl-devel libcurl-devel libjpeg-devel libpng-devel libicu-devel openldap-devel

Download Unzip PHP:

Http://php.net/downloads.php can be downloaded to the latest version of PHP, here is the download of php-5.6.8.tar.gz.

1 wget http://cn2.php.net/distributions/php-5.6.8.tar.gz2tar -xzvf php-5.6. 8. Tar . GZ 3 CD php-5.6. 8

Compiling PHP:

 file -path=/usr/local/php/etc--enable-fpm--with-fpm-user=php-fpm--with-fpm-group=php-fpm--with-mysql= Mysqlnd--with-mysql-sock=/tmp/mysql.sock--with-libxml-dir --WITH-GD-- With-jpeg-dir --with-png-dir -- With-freetype-dir --with-iconv-dir -- With-zlib-dir --with-mcrypt--enable-soap--enable-gd-native-ttf--enable-< Span style= "color: #0000ff;" >ftp --enable-mbstring--enable-exif--disable-ipv6--with-pear--with-curl--with-openssl--with-apxs2=/usr/ Local/apache/bin/apxs 

Note:--with-apxs2=/usr/local/apache/bin/apxs need to add, otherwise apache/modules inside there is no libphp5.so, Httpd.conf also does not add LoadModule php5_module modules/libphp5.so this line.

Let Apache support PHP:

Open the/usr/local/apache/conf/httpd.conf file and enter the following code on the last side:

1 addtype application/x-httpd-php  . php2 addtype application/x-httpd-php-source  . Phps

Navigate to DirectoryIndex index.html, modified to:

1 directoryindex  index.php  index.html

It is important to note whether the PHP extension is already open in/usr/local/apache/conf/httpd.conf:

1 LoadModule php5_module        modules/libphp5.so

Test installation:

1 /usr/local/apache/htdocs/index.php

Enter the following code:

<? PHP    Echo Phpinfo ();


If you can display Phpinfo, you are successful.

Build and install PHP5.6 under CentOS

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.