Centos6.5 install php 7

Source: Internet
Author: User

Centos6.5 install php 7

Create users and groups

Groupadd www

Useradd-g www

Usermod-s/sbin/nologin www

Install Components

Yum install-y libxml2 libxml2-devel libxml2-python curl-devel libjpeg-devel libpng libpng10 libpng10-devel libpng-devel freetype-devel libmcrypt-devel gd-devel

Clear Cache

Yum clean all

Download the latest php-7.0.6

Extract

Tar zxvf php-7.0.6.tar.gz-C/usr/src/

Cd/usr/src/php-7.0.6/

./Configure -- prefix =/usr/local/php -- with-config-file-path =/usr/local/php/etc \

-- With-freetype-dir -- with-jpeg-dir -- with-png-dir -- with-zlib \

-- With-libxml-dir -- enable-xml -- enable-bcmath \

-- Enable-shmop -- enable-sysvsem -- enable-inline-optimization -- with-curl \

-- Enable-mbregex -- enable-fpm -- enable-mbstring \

-- With-mcrypt -- with-gd -- enable-gd-native-ttf -- with-openssl -- with-mhash \

-- Enable-pcntl -- enable-sockets \

-- With-xmlrpc -- enable-zip -- enable-soap -- with-mysql-sock =/data/3306/mysqld. sock \

-- With-curl =/usr -- with-gettext -- with-iconv -- enable-mysqlnd \

-- With-mysqli = mysqlnd \

-- With-pdo-mysql = mysqlnd \

Install

Make

Make install

++

In particular, PHP 7 officially removed the mysql extension.

Use mysqlnd driver

If you continue to use the compilation method of the old version

-- With-mysql =/usr/local/mysql -- enable-embedded-mysqli -- with-mysqli =/usr/local/mysql/bin/mysql_config

An error is reported during make.

Make: *** [ext/mysqli/mysqli_embedded.lo] Error 1

So I changed

-- Enable-mysqlnd -- with-mysqli = mysqlnd -- with-pdo-mysql = mysqlnd

Can be compiled successfully

++ +

Copy the configuration file and startup script

Cp php. ini-production/usr/local/php/etc/php. ini

Cp/usr/local/php/etc/php-fpm.conf.default/usr/local/php/etc/php-fpm.conf

Cp sapi/fpm/init. d. php-fpm/etc/init. d/php-fpm

Cp/usr/local/php/etc/php-fpm.d/www. conf. default/usr/local/php/etc/php-fpm.d/www. conf

Cd/usr/local/php/etc/php-fpm.d

Edit configuration file

Vi www. conf

Modify user and group to www

User = www

Group = www

Set the script permission and add it to auto-start upon startup.

Chmod + x/etc/init. d/php-fpm

Chkconfig -- add php-fpm

Chkconfig -- level 2345 php-fpm on

Start php-fpm

/Etc/init. d/php-fpm start

Check whether the port is enabled

Netstat-anpt | grep php-fpm

Tcp 0 0 127.0.0.1: 9000 0.0.0.0: * LISTEN 25727/php-fpm

Related Article

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.