centos7-minimal安装php5.6.31

1.首先 点击这里下载安装包 php-5.6.31.tar.gz

系统版本:

uname -a
Linux master 3.10.0-514.el7.x86_64 #1 SMP Tue Nov 22 16:42:41 UTC 2016 x86_64 x86_64 x86_64 GNU/Linux

2.上传tar包到指定路径: /home/liuzongyang/tars

3.进入文件夹并解压

cd /home/liuzongyang/tars/
tar xzf php-5.6.31.tar.gz

4.进入php安装文件夹

cd php-5.6.31
5.安装依赖环境(这里放心执行,没有的环境会自动安装,有的环境会自动跳过)
yum -y install libxml2 libxml2-devel
yum -y install curl curl-devel
yum -y install libpng libpng-devel
yum -y install freetype-devel
yum -y install libxslt-devel
yum -y install gcc
yum -y install openssl openssl-devel
ln -s /usr/lib64/libssl.so /usr/lib/
6.执行配置命令

mkdir /usr/local/php
./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-pdo-mysql --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
7.静静等待...当看到这个内容的时候  就表明配置成功了

Generating files
configure: creating ./config.status
creating main/internal_functions.c
creating main/internal_functions_cli.c
+--------------------------------------------------------------------+
| License:                                                           |
| This software is subject to the PHP License, available in this     |
| distribution in the file LICENSE.  By continuing this installation |
| process, you are bound by the terms of this license agreement.     |
| If you do not agree with the terms of this license, you must abort |
| the installation process at this point.                            |
+--------------------------------------------------------------------+

Thank you for using PHP.

config.status: creating php5.spec
config.status: creating main/build-defs.h
config.status: creating scripts/phpize
config.status: creating scripts/man1/phpize.1
config.status: creating scripts/php-config
config.status: creating scripts/man1/php-config.1
config.status: creating sapi/cli/php.1
config.status: creating sapi/fpm/php-fpm.conf
config.status: creating sapi/fpm/init.d.php-fpm
config.status: creating sapi/fpm/php-fpm.service
config.status: creating sapi/fpm/php-fpm.8
config.status: creating sapi/fpm/status.html
config.status: creating sapi/cgi/php-cgi.1
config.status: creating ext/phar/phar.1
config.status: creating ext/phar/phar.phar.1
config.status: creating main/php_config.h
config.status: executing default commands
8.执行安装命令

make && make install
9.执行过程中会不断的跳类似如下代码,不用紧张,继续等待,此过程大概10分钟左右(我也不知道php为啥整的这么麻烦,java就简单的一B!!,有同感的求点赞)

/bin/sh /home/liuzongyang/tars/php-5.6.31/libtool --silent --preserve-dup-deps --mode=compile cc -I/home/liuzongyang/tars/php-5.6.31/ext/sqlite3/libsqlite -DSQLITE_ENABLE_FTS3=1 -DSQLITE_CORE=1 -DSQLITE_ENABLE_COLUMN_METADATA=1 -DSQLITE_THREADSAFE=0  -Iext/sqlite3/ -I/home/liuzongyang/tars/php-5.6.31/ext/sqlite3/ -DPHP_ATOM_INC -I/home/liuzongyang/tars/php-5.6.31/include -I/home/liuzongyang/tars/php-5.6.31/main -I/home/liuzongyang/tars/php-5.6.31 -I/home/liuzongyang/tars/php-5.6.31/ext/date/lib -I/home/liuzongyang/tars/php-5.6.31/ext/ereg/regex -I/usr/include/libxml2 -I/usr/include/freetype2 -I/home/liuzongyang/tars/php-5.6.31/ext/mbstring/oniguruma -I/home/liuzongyang/tars/php-5.6.31/ext/mbstring/libmbfl -I/home/liuzongyang/tars/php-5.6.31/ext/mbstring/libmbfl/mbfl -I/home/liuzongyang/tars/php-5.6.31/ext/sqlite3/libsqlite -I/home/liuzongyang/tars/php-5.6.31/ext/zip/lib -I/home/liuzongyang/tars/php-5.6.31/TSRM -I/home/liuzongyang/tars/php-5.6.31/Zend    -I/usr/include -g -O2 -fvisibility=hidden  -c /home/liuzongyang/tars/php-5.6.31/ext/sqlite3/libsqlite/sqlite3.c -o ext/sqlite3/libsqlite/sqlite3.lo 

10.当看到如下信息,则表明编译成功

Build complete.
Don't forget to run 'make test'.

Installing shared extensions:     /usr/local/php/lib/php/extensions/no-debug-non-zts-20131226/
Installing PHP CLI binary:        /usr/local/php/bin/
Installing PHP CLI man page:      /usr/local/php/php/man/man1/
Installing PHP FPM binary:        /usr/local/php/sbin/
Installing PHP FPM config:        /usr/local/php/etc/
Installing PHP FPM man page:      /usr/local/php/php/man/man8/
Installing PHP FPM status page:   /usr/local/php/php/php/fpm/
Installing PHP CGI binary:        /usr/local/php/bin/
Installing PHP CGI man page:      /usr/local/php/php/man/man1/
Installing build environment:     /usr/local/php/lib/php/build/
Installing header files:           /usr/local/php/include/php/
Installing helper programs:       /usr/local/php/bin/
  program: phpize
  program: php-config
Installing man pages:             /usr/local/php/php/man/man1/
  page: phpize.1
  page: php-config.1
Installing PEAR environment:      /usr/local/php/lib/php/
[PEAR] Archive_Tar    - installed: 1.4.3
[PEAR] Console_Getopt - installed: 1.4.1
[PEAR] Structures_Graph- installed: 1.1.1
[PEAR] XML_Util       - installed: 1.4.2
[PEAR] PEAR           - installed: 1.10.5
Wrote PEAR system config file at: /usr/local/php/etc/pear.conf
You may want to add: /usr/local/php/lib/php to your php.ini include_path
/home/liuzongyang/tars/php-5.6.31/build/shtool install -c ext/phar/phar.phar /usr/local/php/bin
ln -s -f phar.phar /usr/local/php/bin/phar
Installing PDO headers:           /usr/local/php/include/php/ext/pdo/

11.至于make test,建议别尝试了,尝试了你也会ctrl+c终止的,12000+测试,够登半小时了

12.配置并启动服务

cp -a php.ini-production /usr/local/php/etc/php.ini
rm -rf /etc/php.ini
ln -s /usr/local/php/etc/php.ini /etc/php.ini
13.将服务文件拷贝到系统,并赋权

cp -a ./sapi/fpm/php-fpm.conf /usr/local/php/etc/php-fpm.conf
cp -a ./sapi/fpm/init.d.php-fpm /etc/init.d/php-fpm
chmod -R 777 /etc/init.d/php-fpm
systemctl enable php-fpm
service start php-fpm












  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值