壹,下载解压

一.首先下载php7 使用wget命令下载

tar xf php-7.2.0.tar.gz
cd php-7.2.0/

wget http://cn2.php.net/distributions/php-7.0.12.tar.bz2

二,安装须要的库

2.然后解压

sudo apt-get install libxml2-dev
sudo apt-get install openssl
sudo apt-get install libssl-dev
sudo apt-get install make
sudo apt-get install curl
sudo apt-get install libcurl4-gnutls-dev
sudo apt-get install libjpeg-dev
sudo apt-get install libpng-dev
sudo apt-get install libmcrypt-dev

tar
-xvf php-7.0.12.tar.bz2

cd php-7.0.12

3,编译

三.然后安装信赖库

./configure –prefix=/usr/local/php
–with-config-file-path=/usr/local/php/etc –enable-fpm
–with-fpm-user=ghostwu

sudo apt-get update

sudo apt-get install libxml2-dev

sudo apt-get  install  build-essential

sudo apt-get install openssl

sudo apt-get install libssl-dev

sudo apt-get install curl

sudo apt-get install libcurl4-gnutls-dev

sudo apt-get install libjpeg-dev

sudo apt-get install libpng-dev

sudo apt-get install libmcrypt-dev

sudo apt-get install libreadline6 libreadline6-dev

sudo apt-get install libfreetype6-dev  

make && sudo make install

4.编译

4,写八个测试文件,测试php

./configure –prefix=/usr/local/php
–with-config-file-path=/usr/local/php/etc –enable-fpm
–with-fpm-user=www –with-fpm-group=www –with-mysqli
–with-pdo-mysql –with-iconv-dir –with-freetype-dir –with-jpeg-dir
–with-png-dir –with-zlib –with-libxml-dir=/usr –enable-xml
–disable-rpath –enable-bcmath –enable-shmop –enable-sysvsem
–enable-inline-optimization –with-curl –enable-mbregex
–enable-mbstring –with-mcrypt –enable-ftp –with-gd
–enable-gd-native-ttf –with-openssl –with-mhash –enable-pcntl
–enable-sockets –with-xmlrpc –enable-zip –enable-soap
–without-pear –with-gettext –disable-fileinfo
–enable-maintainer-zts

必发娱乐官方网站 1

比如提醒configure: error: Cannot find OpenSSL’s
libraries,请看另1篇小说:设置php提醒 configure: error: Cannot find
OpenSSL’s libraries 解决方案


得逞后会输出:

如上为裸装php

Thank you for using PHP.

倘诺须求丰硕扩大能够重新编写翻译,或许用增添安装格局,记得重新编写翻译在此之前要make
clean或许另行删除解压

make && make install

 较为主导的庞大安装

5.底下是对php-fpm运转用户实行安装 (一般为nginx用户)

./configure –prefix=/usr/local/php \
–with-config-file-path=/usr/local/php/etc \
–with-apxs2=/usr/local/httpd/bin/apxs \
–with-iconv-dir=/usr/local/lib \
–enable-fpm –with-fpm-user=ghostwu \
–with-iconv-dir=/usr/local/lib \
–enable-mysqlnd \
–with-pdo-mysql=mysqlnd \
–with-openssl \
–with-zlib

配置php-fpm

 

cd /usr/local/php/etc

复制php-fpm文件

cp php-fpm.conf.default php-fpm.conf

打开php-fpm文件

vim php-fpm.conf

编辑php-fpm文件

找到

;error_log = log/php-fpm.log 

;include=/usr/local/php/etc/php-fpm.d/*必发娱乐官方网站,.conf

若果有注释,就去掉前边的注释    【;】

进入php-fpm.d目录

cd php-fpm.d

修改 www.conf 文件:

若是那几个文件不设有,就从default复制1份:

cp www.conf.default www.conf

vim www.conf

将配置文件中的 user 和 group 部分的 nobody 改成 www:

修改

user = www

group = www

假定�www用户不存在,那么先增加www用户

groupadd www

useradd -g www www

启动php-fpm

sudo /usr/local/php/sbin/php-fpm -R

陆.投入体系变量

打开 /etc/profile文件

sudo vi /etc/profile

到场或修改path

export PATH=$PATH:/usr/local/php/bin

让修改生效

source /etc/profile

测试

php -v


推荐文章,linux下编写翻译安装nginx 

http://www.jianshu.com/p/a0abbe0a443f

Author

发表评论

电子邮件地址不会被公开。 必填项已用*标注