centos安装PHP7.3

tar zxvf xxx.tar.gz 解压

./configure --prefix=/usr/local/php73 --with-config-file-path=/etc/php73 --enable-inline-optimization --disable-debug --disable-rpath --enable-shared --enable-opcache --enable-fpm --with-fpm-user=www --with-fpm-group=www --with-mysql=mysqlnd --with-mysqli=mysqlnd --with-pdo-mysql=mysqlnd --enable-mbstring --with-iconv --with-mcrypt --with-mhash --with-openssl --enable-bcmath --enable-soap --with-libxml-dir --enable-pcntl --enable-shmop --enable-sysvmsg --enable-sysvsem --enable-sysvshm --enable-sockets --with-curl --with-zlib --enable-zip --with-readline --without-sqlite3 --without-pdo-sqlite --with-pear

编译检查过程中提示缺少什么就安装什么
比如如果缺少openssl或者找不到目录就指定一下目录,还不行就再装一次openssl :yum install openssl openssl-devel

makefile生成完毕,环境检查完毕:

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 php7.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/www.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/phpdbg/phpdbg.1
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
configure: WARNING: unrecognized options: --with-mysql, --with-mcrypt
[root@localhost php-7.3.0]# pwd
/root/download/php-7.3.0
[root@localhost php-7.3.0]# 

接下来make ,make install
make报错:

In file included from /root/download/php-7.3.0/ext/zip/php_zip.h:31:0,
                 from /root/download/php-7.3.0/ext/zip/php_zip.c:36:
/usr/local/include/zip.h:59:21: fatal error: zipconf.h: No such file or directory
 #include 
                     ^
compilation terminated.
make: *** [ext/zip/php_zip.lo] Error 1

找不到文件,加zipconf.h软连接
cp /usr/local/lib/libzip/include/zipconf.h /usr/local/include/zipconf.h

make结果:

Generating phar.php
Generating phar.phar
PEAR package PHP_Archive not installed: generated phar will require PHP's phar extension be enabled.
clicommand.inc
directorytreeiterator.inc
pharcommand.inc
directorygraphiterator.inc
invertedregexiterator.inc
phar.inc

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

make install 结果:

[root@localhost php-7.3.0]# make install
Installing shared extensions:     /usr/local/php73/lib/php/extensions/no-debug-non-zts-20180731/
Installing PHP CLI binary:        /usr/local/php73/bin/
Installing PHP CLI man page:      /usr/local/php73/php/man/man1/
Installing PHP FPM binary:        /usr/local/php73/sbin/
Installing PHP FPM defconfig:     /usr/local/php73/etc/
Installing PHP FPM man page:      /usr/local/php73/php/man/man8/
Installing PHP FPM status page:   /usr/local/php73/php/php/fpm/
Installing phpdbg binary:         /usr/local/php73/bin/
Installing phpdbg man page:       /usr/local/php73/php/man/man1/
Installing PHP CGI binary:        /usr/local/php73/bin/
Installing PHP CGI man page:      /usr/local/php73/php/man/man1/
Installing build environment:     /usr/local/php73/lib/php/build/
Installing header files:          /usr/local/php73/include/php/
Installing helper programs:       /usr/local/php73/bin/
  program: phpize
  program: php-config
Installing man pages:             /usr/local/php73/php/man/man1/
  page: phpize.1
  page: php-config.1
Installing PEAR environment:      /usr/local/php73/lib/php/

Warning: "continue" targeting switch is equivalent to "break". Did you mean to use "continue 2"? in phar:///root/download/php-7.3.0/pear/install-pear-nozlib.phar/PEAR/PackageFile/v2/Validator.php on line 1933
[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/php73/etc/pear.conf
You may want to add: /usr/local/php73/lib/php to your php.ini include_path
/root/download/php-7.3.0/build/shtool install -c ext/phar/phar.phar /usr/local/php73/bin
ln -s -f phar.phar /usr/local/php73/bin/phar
Installing PDO headers:           /usr/local/php73/include/php/ext/pdo/

首次运行php-fpm配置文件准备:

cp /usr/local/php73/etc/php-fpm.conf.default /usr/local/php73/etc/php-fpm.conf

cp /usr/local/php73/etc/php-fpm.d/www.conf.default /usr/local/php73/etc/php-fpm.d/www.conf

vim /usr/local/php73/etc/php-fpm.d/www.conf 将user和group设置成nginx

你可能感兴趣的:(PHP,Linux)