Introduction to how to compile and install PHP 5/PHP 7 on CendOS 6.5

Source: Internet
Author: User

First install some dependent software packages:

Yum install libmcrypt. x86_64 libpng. x86_64 libjpeg-turbo.x86_64 \
Libxml2.x86 _ 64 readline. x86_64 libxml2-devel.x86_64 openssl. x86_64 \
Openssl-devel.x86_64 libcurl-devel.x86_64 libjpeg-turbo-devel.x86_64 \
Libwebp-devel.x86_64 libpng-devel.x86_64 freetype-devel.x86_64 \
Libmcrypt-devel.x86_64 readline-devel.x86_64
Then, configure the PHP 7 compilation options correctly.

./Configure-C \
-- Prefix =/usr/local/php \
-- With-readline \
-- With-curl \
-- With-gd \
-- With-iconv \
-- With-gettext \
-- With-mcrypt \
-- With-mysqli \
-- With-openssl \
-- Enable-pcntl \
-- Enable-soap \
-- Enable-mbstring \
-- With-zlib \
-- Enable-fpm \
-- With-freetype-dir =/usr \
-- With-jpeg-dir =/usr \
-- With-webp-dir =/usr \
-- With-png-dir =/usr
Finally, execute the compilation Command:

# Use 2 cores to determine the CPU usage.
Make-j 2
Make install
After compilation, compile opcache separately. Although I think this should be compiled into the PHP interpreter,
However, currently, I only find the method used in extension mode.

Cd ext/opcode
/Usr/local/php/bin/phpize
./Configure -- with-php-config =/usr/local/php/bin/php-config
Make-j 2
Make install
Then edit the configuration file and add:

Zend_extension = opcache. so
=====

The following is the PHP 5 compilation script:

#! /Bin/bash
 
Yum-yq install libmcrypt. x86_64 libpng. x86_64 libjpeg-turbo.x86_64 \
Libxml2.x86 _ 64 readline. x86_64 libxml2-devel.x86_64 openssl. x86_64 \
Openssl-devel.x86_64 libcurl-devel.x86_64 libjpeg-turbo-devel.x86_64 \
Libwebp-devel.x86_64 libpng-devel.x86_64 freetype-devel.x86_64 \
Libmcrypt-devel.x86_64 readline-devel.x86_64 libtool-ltdl-devel.x86_64
 
./Configure-C \
-- Prefix =/usr/local/php-5.5.16 \
-- With-readline \
-- With-curl \
-- With-gd \
-- With-iconv \
-- With-gettext \
-- With-mcrypt \
-- With-mysqli \
-- With-pdo-mysql \
-- With-openssl \
-- Enable-pcntl \
-- Enable-soap \
-- Enable-mbstring \
-- With-zlib \
-- Enable-fpm \
-- With-freetype-dir =/usr \
-- With-jpeg-dir =/usr \
-- With-png-dir =/usr

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.