centos7-minimal安装php5.6.31

来源:互联网 发布:淘宝网货源网靠谱么? 编辑:程序博客网 时间:2024/05/22 12:46

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

系统版本:

uname -aLinux 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-develyum -y install curl curl-develyum -y install libpng libpng-develyum -y install freetype-develyum -y install libxslt-develyum -y install gccyum -y install openssl openssl-develln -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 filesconfigure: creating ./config.statuscreating main/internal_functions.ccreating 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.specconfig.status: creating main/build-defs.hconfig.status: creating scripts/phpizeconfig.status: creating scripts/man1/phpize.1config.status: creating scripts/php-configconfig.status: creating scripts/man1/php-config.1config.status: creating sapi/cli/php.1config.status: creating sapi/fpm/php-fpm.confconfig.status: creating sapi/fpm/init.d.php-fpmconfig.status: creating sapi/fpm/php-fpm.serviceconfig.status: creating sapi/fpm/php-fpm.8config.status: creating sapi/fpm/status.htmlconfig.status: creating sapi/cgi/php-cgi.1config.status: creating ext/phar/phar.1config.status: creating ext/phar/phar.phar.1config.status: creating main/php_config.hconfig.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-configInstalling man pages:             /usr/local/php/php/man/man1/  page: phpize.1  page: php-config.1Installing 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.5Wrote PEAR system config file at: /usr/local/php/etc/pear.confYou 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/binln -s -f phar.phar /usr/local/php/bin/pharInstalling 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.inirm -rf /etc/php.iniln -s /usr/local/php/etc/php.ini /etc/php.ini
13.将服务文件拷贝到系统,并赋权

cp -a ./sapi/fpm/php-fpm.conf /usr/local/php/etc/php-fpm.confcp -a ./sapi/fpm/init.d.php-fpm /etc/init.d/php-fpmchmod -R 777 /etc/init.d/php-fpmsystemctl enable php-fpmservice start php-fpm












原创粉丝点击