系统相关
首页 > 系统相关> > linux安装php7.1与composer

linux安装php7.1与composer

作者:互联网

1 安装php

1.1 安装依赖包

yum install -y gcc gcc-c++  make zlib zlib-devel pcre pcre-devel  libjpeg libjpeg-devel libpng libpng-devel freetype freetype-devel libxml2 libxml2-devel glibc glibc-devel glib2 glib2-devel bzip2 bzip2-devel ncurses ncurses-devel curl curl-devel e2fsprogs e2fsprogs-devel krb5 krb5-devel openssl openssl-devel openldap openldap-devel nss_ldap openldap-clients openldap-servers

1.2 下载安装包

cd /usr/local
wget https://www.php.net/distributions/php-7.1.31.tar.gz

1.3 解压

tar -zxvf php-7.1.31.tar.gz

1.4 检查当前的环境是否满足要安装软件的依赖关系

cd php-7.1.31

 

./configure --prefix=/usr/local/php --with-config-file-path=/usr/local/php --enable-mbstring --enable-ftp --with-gd --with-jpeg-dir=/usr --with-png-dir=/usr --with-mysql=mysqlnd --with-mysqli=mysqlnd --with-pdo-mysql=mysqlnd --without-pear  --disable-phar --enable-sockets --with-freetype-dir=/usr --with-zlib --with-libxml-dir=/usr --with-xmlrpc --enable-zip --enable-fpm --enable-xml --enable-sockets --with-gd --with-zlib --with-iconv --enable-zip --with-freetype-dir=/usr/lib/ --enable-soap --enable-pcntl --enable-cli --with-curl

1.5 编译安装

make
make install

 

1.6 在之前编译的源码包中,找到 php.ini-production,复制到/usr/local/php下,并改名为php.ini

cp php.ini-production /usr/local/php/php.ini

 [可选项] 设置让PHP错误信息打印在页面上

vim /usr/local/php/php.ini 

 将Off改成On

如果是这样就不用改

1.7 复制启动脚本

启动脚本目录:  /usr/local/php-7.1.31/sapi/fpm/init.d.php-fpm/

cp ./sapi/fpm/init.d.php-fpm /etc/init.d/php-fpm
chmod +x /etc/init.d/php-fpm

 修改php-fpm配置文件

cd /usr/local/php/etc

 

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

 

vim php-fpm.conf

 

 

https://www.cnblogs.com/houss/p/11296285.html

标签:enable,--,php7.1,devel,fpm,usr,composer,linux,php
来源: https://www.cnblogs.com/polax/p/14439100.html