温馨提示×

温馨提示×

您好,登录后才能下订单哦!

密码登录×
登录注册×
其他方式登录
点击 登录注册 即表示同意《亿速云用户服务条款》

linux环境中怎么安装php7.0

发布时间:2021-07-09 10:41:45 来源:亿速云 阅读:138 作者:Leah 栏目:编程语言

本篇文章为大家展示了linux环境中怎么安装php7.0,内容简明扼要并且容易理解,绝对能使你眼前一亮,通过这篇文章的详细介绍希望你能有所收获。

linux环境下php7.0怎么安装?

Linux环境PHP7.0安装

PHP7和HHVM比较

PHP7的在真实场景的性能确实已经和HHVM相当, 在一些场景甚至超过了HHVM。

HHVM的运维复杂, 是多线程模型, 这就代表着假设一个线程导致crash了, 那么整个服务就挂了, 而且它不会自己主动重新启动。

另外它採用JIT, 那么意味着, 重新启动以后要预热, 没有预热的情况下, 性能较为糟糕。而且多线程模型调试困难, 这对于追求稳定来说的Web服务来说, 是非常不适合的。

Nginx以及PHP7.0之前的版本号能够參考此文:Linux环境Nginx安装与调试以及PHP安装

PHP7.0正式版已经在2015年11月份左右公布。眼下是PHP7.0.2版本号,本人最早是从2015年8月php7的第一个測试版跟起,如今正式版公布。

linux版本号:64位CentOS 6.6

Nginx版本号:nginx1.8.0

php版本号:php-7.0.2

下载

# wget  http://php.net/get/php-7.0.2.tar.gz/from/a/mirror

建议安装之前先看看安装帮助文件INSTALL

解压安装

# tar zxvf php-7.0.2.tar.gz
# cd php-7.0.2

首先查看安装帮助

# ./configure   --help
# ./configure --prefix=/usr/local/php \
 --with-curl \
 --with-freetype-dir \
 --with-gd \
 --with-gettext \
 --with-iconv-dir \
 --with-kerberos \
 --with-libdir=lib64 \
 --with-libxml-dir \
 --with-mysqli \
 --with-openssl \
 --with-pcre-regex \
 --with-pdo-mysql \
 --with-pdo-sqlite \
 --with-pear \
 --with-png-dir \
 --with-xmlrpc \
 --with-xsl \
 --with-zlib \
 --enable-fpm \
 --enable-bcmath \
 --enable-libxml \
 --enable-inline-optimization \
 --enable-gd-native-ttf \
 --enable-mbregex \
 --enable-mbstring \
 --enable-opcache \
 --enable-pcntl \
 --enable-shmop \
 --enable-soap \
 --enable-sockets \
 --enable-sysvsem \
 --enable-xml \
 --enable-zip

假设配置错误,须要安装须要的模块,直接yum一并安装依赖库

# yum -y install libjpeg libjpeg-devel libpng libpng-devel freetype freetype-devel libxml2 libxml2-devel mysql pcre-devel

注意:安装php7beta3的时候有几处配置只是去,须要yum一下。如今php-7.0.2已经不用这样了。

# yum -y install curl-devel
# yum -y install libxslt-devel

编译安装

# make &&  make install

配置文件

# cp php.ini-development /usr/local/php/lib/php.ini
# cp /usr/local/php/etc/php-fpm.conf.default /usr/local/php/etc/php-fpm.conf
# cp /usr/local/php/etc/php-fpm.d/www.conf.default /usr/local/php/etc/php-fpm.d/www.conf
# cp -R ./sapi/fpm/php-fpm /etc/init.d/php-fpm

配置环境变量

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

须要注意的是php7中www.conf这个配置文件配置phpfpm的端口号等信息,假设你改动默认的9000端口号需在这里改,再改nginx的配置

启动

#  /etc/init.d/php-fpm

上述内容就是linux环境中怎么安装php7.0,你们学到知识或技能了吗?如果还想学到更多技能或者丰富自己的知识储备,欢迎关注亿速云行业资讯频道。

向AI问一下细节

免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。

AI