centos6 install and configure PHP 7.0

In early 2015, 12 PHP7 official release, ushered in since 2004, the largest version of the update. The most significant change is PHP7 greatly enhance performance, close to the Facebook developers of PHP execution engine HHVM. In WordPress benchmark, the 5.6 version is faster than the speed of 2 to 3 times, greatly reducing the memory footprint. PHP7 there are some changes in the language, such as adding the return type declaration, added some new reserved keywords. In terms of security, in addition to PHP safe mode, add magic quotes and so on. Not only that, the new version also supports 64-bit, and includes the latest version of the Zend Engine.

April 2016, following the installation notes PHP7

1. Check the operating system version, using centos6.7
# RPM -q CentOS-Release

centos-release-6-7.el6.centos.12.3.x86_64

2. Make sure mysql, nginx has been launched, which nginx configured to start automatically, manually start now mysql

@fox php-7.0.14]# service mysqld start

Starting MySQL SUCCESS! 

[root@fox php-7.0.14]# lsof -i:80

COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME
nginx 13308 root 6u IPv4 39424 0t0 TCP *:http (LISTEN)
nginx 13310 nginx 6u IPv4 39424 0t0 TCP *:http (LISTEN)

[root@fox php-7.0.14]# lsof -i:3306

3. Install, configure PHP

(1). Delete the previous version of php

* Remove yum PHP PHP #-Common 
 (2) mounted Php7 .rpm respective source yum

CentOS/RHEL 7.x:

RPM -Uvh https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm #
# RPM -Uvh https://mirror.webtatic.com/yum/el7/webtatic-release .rpm
the CentOS / RHEL 6.x:
# RPM -Uvh https://mirror.webtatic.com/yum/el6/latest.rpm
 (. 3) mounted php7 .yum

#yum install php70w php70w-cli php70w-common php70w-devel php70w-embedded php70w-fpm php70w-gd php70w-mbstring php70w-mysqlnd php70w-opcache php70w-pdo php70w-xml -y

(4) Support PHP configuration nginx

      we /etc/nginx/conf.d/default.conf 

  location ~ \.php$ {
    root           html;
    fastcgi_pass   127.0.0.1:9000;
    fastcgi_index  index.php;
    fastcgi_param  SCRIPT_FILENAME   $document_root$fastcgi_script_name;
    include        fastcgi_params;
  }

"/etc/nginx/conf.d/default.conf" 52L, 1359C written 

4. Restart nginx and PHP

[root@fox php-7.0.14]# /etc/init.d/nginx restart
Stopping nginx: [ OK ]
Starting nginx: [ OK ]
[root@fox php-7.0.14]# /etc/init.d/php-fpm start
Starting php-fpm: [ OK ]

5. Verify

(1) write a PHP file

cat >>/usr/share/nginx/html/test.php<<HI
<?php
phpinfo();
?>
HI

(2) to open the browser, see this interface, the installation is successful

Note:

1, I used to learn is compiled and installed handmade, hand encountered a different version installed, you need to carefully read the official installation documentation; it is a lot easier to install using yum

2, before yum install php7, if the system has the latest update, smooth installation, if not the latest update, the following may have to manually install dependencies

yum install libxm12-devel zlib-devel libjpeg-devel libjpeg-turbo-devel libiconv-devel freetype-devel libpng-devel gd-devel libcurl-devel libxslt-devel -y

wget http://ftp.gnu.org/pub/gnu/libiconv/libiconv-1.14.tar.gz

tar zxf libiconv-1.14.tar.gz
cd libiconv-1.14
./configure --prefix=/usr/local/libiconv
make && make install

wget -O /etc/yum.repos.d/epel.epel.repo http://mirrors.aliyun.com/repo/epel-6.repo

yum -y install libmcrypt-devel
yum -y install mhash
yum -y install mcrypt

 

Guess you like

Origin www.cnblogs.com/micfox/p/10992561.html