阿里云Centos7.2 安装Wrodpress5.2 之 Php 7.3.8环境安装

本机已经安装了mysql。

下载php7.3.8 https://www.php.net/distributions/php-7.3.8.tar.gz

下载wordpresshttps://wordpress.org/latest.tar.gz

安装php

解压到/usr/local下,重命名为php738

tar -zxvf php-7.3.8.tar.gz
mv php-7.3.8/ php738

进入php目录php738安装,

执行命令

./configure --enable-fpm --prefix=/usr/local/php738 --with-config-file-path=/usr/local/php7.3/etc --with-apxs2=/usr/local/apache/bin/apxs --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-jpeg-dir --with-xmlrpc --with-xsl --with-zlib --with-openssl --enable-fpm --enable-bcmath --enable-libxml --enable-inline-optimization --enable-mbregex --enable-mbstring --enable-opcache --enable-pcntl --enable-shmop --enable-soap --enable-sockets --enable-sysvsem --enable-xml --enable-zip

报错

Configuring SAPI modules
checking for Apache 2.0 handler-module support via DSO through APXS...

Sorry, I cannot run apxs.  Possible reasons follow:

1. Perl is not installed
2. apxs was not found. Try to pass the path using --with-apxs2=/path/to/apxs
3. Apache was not built using --enable-so (the apxs usage page is displayed)

那么,先安装perl

yum install perl

安装httpd-devel

yum install  httpd-devel

查询apxs路径

find / -name apxs

找到路径是/usr/bin/apxs,那么指定路径执行命令

./configure --enable-fpm --prefix=/usr/local/php738 --with-config-file-path=/usr/local/php7.3/etc --with-apxs2=/usr/local/apache/bin/apxs --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-jpeg-dir --with-xmlrpc --with-xsl --with-zlib --with-openssl --enable-fpm --enable-bcmath --enable-libxml --enable-inline-optimization --enable-mbregex --enable-mbstring --enable-opcache --enable-pcntl --enable-shmop --enable-soap --enable-sockets --enable-sysvsem --enable-xml --enable-zip --with-apxs2=/usr/bin/apxs

报错

checking for pkg-config... /usr/bin/pkg-config
configure: error: libxml2 not found. Please check your libxml2 installation.

那么,安装libxml2-devel

yum install libxml2-devel

继续执行命令

./configure --enable-fpm --prefix=/usr/local/php738 --with-config-file-path=/usr/local/php7.3/etc --with-apxs2=/usr/local/apache/bin/apxs --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-jpeg-dir --with-xmlrpc --with-xsl --with-zlib --with-openssl --enable-fpm --enable-bcmath --enable-libxml --enable-inline-optimization --enable-mbregex --enable-mbstring --enable-opcache --enable-pcntl --enable-shmop --enable-soap --enable-sockets --enable-sysvsem --enable-xml --enable-zip --with-apxs2=/usr/bin/apxs

报错

checking for pkg-config... /usr/bin/pkg-config
configure: error: Cannot find OpenSSL's 

说是没找到openssl,但是我本机执行了下命令,发现是安装了openssl

[root@jiba php738]# openssl
OpenSSL>
[root@jiba files]# whereis openssl
openssl: /usr/bin/openssl /usr/lib64/openssl /usr/share/man/man1/openssl.1ssl.gz

那么再执行configure命令式,增加连接 

--with-openssl-dir=/usr/bin/openssl/ 

执行

./configure --enable-fpm --prefix=/usr/local/php738 --with-config-file-path=/usr/local/php7.3/etc --with-apxs2=/usr/local/apache/bin/apxs --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-jpeg-dir --with-xmlrpc --with-xsl --with-zlib --with-openssl --enable-fpm --enable-bcmath --enable-libxml --enable-inline-optimization --enable-mbregex --enable-mbstring --enable-opcache --enable-pcntl --enable-shmop --enable-soap --enable-sockets --enable-sysvsem --enable-xml --enable-zip --with-apxs2=/usr/bin/apxs  --with-openssl-dir=/usr/bin/openssl/

还是不行,那么经查,安装install libssl-dev

yum install libssl-dev

但是没找到

[root@jiba php738]# yum install libssl-dev
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
No package libssl-dev available.
Error: Nothing to do

查了下,得安装openssl-devel

yum install openssl-devel

然后执行configure,也去掉ssl的  --with-openssl-dir=/usr/bin/openssl/ 

./configure --enable-fpm --prefix=/usr/local/php738 --with-config-file-path=/usr/local/php7.3/etc --with-apxs2=/usr/local/apache/bin/apxs --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-jpeg-dir --with-xmlrpc --with-xsl --with-zlib --with-openssl --enable-fpm --enable-bcmath --enable-libxml --enable-inline-optimization --enable-mbregex --enable-mbstring --enable-opcache --enable-pcntl --enable-shmop --enable-soap --enable-sockets --enable-sysvsem --enable-xml --enable-zip --with-apxs2=/usr/bin/apxs 

然后报错

checking for cURL 7.15.5 or greater... configure: error: cURL version 7.15.5 or later is required to compile php with cURL support

那么安装curl-devel

yum install curl-devel

继续执行configure命令

./configure --enable-fpm --prefix=/usr/local/php738 --with-config-file-path=/usr/local/php7.3/etc --with-apxs2=/usr/local/apache/bin/apxs --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-jpeg-dir --with-xmlrpc --with-xsl --with-zlib --with-openssl --enable-fpm --enable-bcmath --enable-libxml --enable-inline-optimization --enable-mbregex --enable-mbstring --enable-opcache --enable-pcntl --enable-shmop --enable-soap --enable-sockets --enable-sysvsem --enable-xml --enable-zip --with-apxs2=/usr/bin/apxs 

报错

If configure fails try --with-webp-dir=
configure: error: jpeglib.h not found.

那么,安装yum install libjpeg-devel

yum install libjpeg-devel

继续执行configure命令

./configure --enable-fpm --prefix=/usr/local/php738 --with-config-file-path=/usr/local/php7.3/etc --with-apxs2=/usr/local/apache/bin/apxs --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-jpeg-dir --with-xmlrpc --with-xsl --with-zlib --with-openssl --enable-fpm --enable-bcmath --enable-libxml --enable-inline-optimization --enable-mbregex --enable-mbstring --enable-opcache --enable-pcntl --enable-shmop --enable-soap --enable-sockets --enable-sysvsem --enable-xml --enable-zip --with-apxs2=/usr/bin/apxs 

报错

checking for jpeg_read_header in -ljpeg... yes
configure: error: png.h not found.

那么,安装libpng libpng-devel

yum install libpng libpng-devel

继续执行configure命令

./configure --enable-fpm --prefix=/usr/local/php738 --with-config-file-path=/usr/local/php7.3/etc --with-apxs2=/usr/local/apache/bin/apxs --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-jpeg-dir --with-xmlrpc --with-xsl --with-zlib --with-openssl --enable-fpm --enable-bcmath --enable-libxml --enable-inline-optimization --enable-mbregex --enable-mbstring --enable-opcache --enable-pcntl --enable-shmop --enable-soap --enable-sockets --enable-sysvsem --enable-xml --enable-zip --with-apxs2=/usr/bin/apxs 

报错

If configure fails try --with-xpm-dir=
configure: error: freetype-config not found.

那么,安装yum install freetype-devel

yum install freetype-devel

继续执行configure命令

./configure --enable-fpm --prefix=/usr/local/php738 --with-config-file-path=/usr/local/php7.3/etc --with-apxs2=/usr/local/apache/bin/apxs --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-jpeg-dir --with-xmlrpc --with-xsl --with-zlib --with-openssl --enable-fpm --enable-bcmath --enable-libxml --enable-inline-optimization --enable-mbregex --enable-mbstring --enable-opcache --enable-pcntl --enable-shmop --enable-soap --enable-sockets --enable-sysvsem --enable-xml --enable-zip --with-apxs2=/usr/bin/apxs 

报错

checking for XSL support... yes
configure: error: xslt-config not found. Please reinstall the libxslt >= 1.1.0 distribution

那么,安装libxslt libxslt-devel

yum install libxslt libxslt-devel

继续执行configure命令

./configure --enable-fpm --prefix=/usr/local/php738 --with-config-file-path=/usr/local/php7.3/etc --with-apxs2=/usr/local/apache/bin/apxs --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-jpeg-dir --with-xmlrpc --with-xsl --with-zlib --with-openssl --enable-fpm --enable-bcmath --enable-libxml --enable-inline-optimization --enable-mbregex --enable-mbstring --enable-opcache --enable-pcntl --enable-shmop --enable-soap --enable-sockets --enable-sysvsem --enable-xml --enable-zip --with-apxs2=/usr/bin/apxs 

报错

checking for libzip... not found
configure: error: Please reinstall the libzip distribution

那么,安装libzip

yum install libzip

继续执行configure命令

./configure --enable-fpm --prefix=/usr/local/php738 --with-config-file-path=/usr/local/php7.3/etc --with-apxs2=/usr/local/apache/bin/apxs --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-jpeg-dir --with-xmlrpc --with-xsl --with-zlib --with-openssl --enable-fpm --enable-bcmath --enable-libxml --enable-inline-optimization --enable-mbregex --enable-mbstring --enable-opcache --enable-pcntl --enable-shmop --enable-soap --enable-sockets --enable-sysvsem --enable-xml --enable-zip --with-apxs2=/usr/bin/apxs 

报错,艹,还是libzip不行

checking for libzip... not found
configure: error: Please reinstall the libzip distribution

那么,先删除,再安装

yum remove libzip
yum install libzip

再次执行configure

./configure --enable-fpm --prefix=/usr/local/php738 --with-config-file-path=/usr/local/php7.3/etc --with-apxs2=/usr/local/apache/bin/apxs --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-jpeg-dir --with-xmlrpc --with-xsl --with-zlib --with-openssl --enable-fpm --enable-bcmath --enable-libxml --enable-inline-optimization --enable-mbregex --enable-mbstring --enable-opcache --enable-pcntl --enable-shmop --enable-soap --enable-sockets --enable-sysvsem --enable-xml --enable-zip --with-apxs2=/usr/bin/apxs 

报错,还是不行。是libzip版本问题,那么安装libzip最新版本

[root@jiba local]# wget https://libzip.org/download/libzip-1.5.2.tar.gz
[root@jiba local]# tar -zxvf libzip-1.5.2.tar.gz
[root@jiba local]# cd libzip-1.5.2
[root@jiba libzip-1.5.2]# mkdir build
[root@jiba libzip-1.5.2]# cd build/
[root@jiba build]# cmake ..

报错 cmake 没找到,那么先安装cmake

yum install cmake

再次执行cmake,艹版本太低,新版本下载了10多分钟,https://cmake.org/download/  cmake-3.15.2.tar.gz   3.15.2版本

[root@jiba build]# cmake ..
CMake Error at CMakeLists.txt:4 (CMAKE_MINIMUM_REQUIRED):
  CMake 3.0.2 or higher is required.  You are running version 2.8.12.2


-- Configuring incomplete, errors occurred!

卸载cmake 重新安装cmake

yum remove cmake
[root@jiba local]# cp cmake-3.15.2.tar.gz /opt/
[root@jiba opt]# tar -zxvf cmake-3.15.2.tar.gz

编辑/etc/profile,增加cmake

export CMAKE_HOME=/opt/cmake-3.15.2
export PATH=$PATH:$CMAKE_HOME/bin

然后发现还是,因为下载错了,我现在的是源码,需要下载的是编译过的二进制版本的,然后发现linux版本的下载需要一个小时,找了找资料发现现在的这个也能用。

得先安装gcc工具

yum -y install gcc gcc-c++ kernel-devel

然后执行编译

[root@jiba cmake-3.15.2]# ./bootstrap

编译了几分钟,成功了

-- Looking for elf.h
-- Looking for elf.h - found
-- Looking for a Fortran compiler
-- Looking for a Fortran compiler - NOTFOUND
-- Performing Test run_pic_test
-- Performing Test run_pic_test - Success
-- Performing Test run_inlines_hidden_test
-- Performing Test run_inlines_hidden_test - Success
-- Configuring done
-- Generating done
-- Build files have been written to: /opt/cmake-3.15.2
---------------------------------------------
CMake has bootstrapped.  Now run gmake.
[root@jiba cmake-3.15.2]#

执行gmake

[root@jiba cmake-3.15.2]# gmake
[root@jiba cmake-3.15.2]# make install

然后 可以把/etc/profile/的配置去掉

#export CMAKE_HOME=/opt/cmake-3.15.2
#export PATH=$PATH:$CMAKE_HOME

cmake终于安装好了

[root@jiba cmake-3.15.2]# cmake -version
cmake version 3.15.2

CMake suite maintained and supported by Kitware (kitware.com/cmake).

现在继续安装libzip,进入libzip/build的目录,执行

[root@jiba build]# pwd
/usr/local/libzip-1.5.2/build
[root@jiba build]# cmake ..
[root@jiba build]# make install

然后,进入php375,执行configure

./configure --enable-fpm --prefix=/usr/local/php738 --with-config-file-path=/usr/local/php7.3/etc --with-apxs2=/usr/local/apache/bin/apxs --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-jpeg-dir --with-xmlrpc --with-xsl --with-zlib --with-openssl --enable-fpm --enable-bcmath --enable-libxml --enable-inline-optimization --enable-mbregex --enable-mbstring --enable-opcache --enable-pcntl --enable-shmop --enable-soap --enable-sockets --enable-sysvsem --enable-xml --enable-zip --with-apxs2=/usr/bin/apxs 

艹,终于好了。

Generating files
configure: creating ./config.status
creating main/internal_functions.c
creating main/internal_functions_cli.c
+--------------------------------------------------------------------+
|                        *** WARNING ***                             |
|                                                                    |
| You have built PHP for Apache's current non-threaded MPM.          |
| If you change Apache to use a threaded MPM you must reconfigure    |
| PHP with --enable-maintainer-zts                                   |
+--------------------------------------------------------------------+
| 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
[root@jiba php738]#

configure执行完毕之后,执行make

[root@jiba php738]# make && make install

终于安装完毕

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

Installing PHP SAPI module:       apache2handler
/usr/lib64/httpd/build/instdso.sh SH_LIBTOOL='/usr/lib64/apr-1/build/libtool' libphp7.la /usr/lib64/httpd/modules
/usr/lib64/apr-1/build/libtool --mode=install install libphp7.la /usr/lib64/httpd/modules/
libtool: install: install .libs/libphp7.so /usr/lib64/httpd/modules/libphp7.so
libtool: install: install .libs/libphp7.lai /usr/lib64/httpd/modules/libphp7.la
libtool: install: warning: remember to run `libtool --finish /usr/local/php738/libs'
chmod 755 /usr/lib64/httpd/modules/libphp7.so
[activating module `php7' in /etc/httpd/conf/httpd.conf]
Installing shared extensions:     /usr/local/php738/lib/php/extensions/no-debug-non-zts-20180731/
Installing PHP CLI binary:        /usr/local/php738/bin/
Installing PHP CLI man page:      /usr/local/php738/php/man/man1/
Installing PHP FPM binary:        /usr/local/php738/sbin/
Installing PHP FPM defconfig:     /usr/local/php738/etc/
Installing PHP FPM man page:      /usr/local/php738/php/man/man8/
Installing PHP FPM status page:   /usr/local/php738/php/php/fpm/
Installing phpdbg binary:         /usr/local/php738/bin/
Installing phpdbg man page:       /usr/local/php738/php/man/man1/
Installing PHP CGI binary:        /usr/local/php738/bin/
Installing PHP CGI man page:      /usr/local/php738/php/man/man1/
Installing build environment:     /usr/local/php738/lib/php/build/
Installing header files:          /usr/local/php738/include/php/
Installing helper programs:       /usr/local/php738/bin/
  program: phpize
  program: php-config
Installing man pages:             /usr/local/php738/php/man/man1/
  page: phpize.1
  page: php-config.1
Installing PEAR environment:      /usr/local/php738/lib/php/
[PEAR] Archive_Tar    - installed: 1.4.7
[PEAR] Console_Getopt - installed: 1.4.2
[PEAR] Structures_Graph- installed: 1.1.1
[PEAR] XML_Util       - installed: 1.4.3
[PEAR] PEAR           - installed: 1.10.9
Wrote PEAR system config file at: /usr/local/php738/etc/pear.conf
You may want to add: /usr/local/php738/lib/php to your php.ini include_path
/usr/local/php738/build/shtool install -c ext/phar/phar.phar /usr/local/php738/bin
ln -s -f phar.phar /usr/local/php738/bin/phar
Installing PDO headers:           /usr/local/php738/include/php/ext/pdo/
[root@jiba php738]#

截图纪念一下逝去的几个小时

阿里云Centos7.2 安装Wrodpress5.2 之 Php 7.3.8环境安装_第1张图片

然后配置php

[root@jiba php738]# ln -s /usr/local/php738/bin/php /usr/local/bin/php
[root@jiba php738]# cp /usr/local/php738/etc/php-fpm.conf.default /usr/local/php738/etc/php-fpm.conf
[root@jiba php738]# cp /usr/local/php738/etc/php-fpm.d/www.conf.default /usr/local/php738/etc/php-fpm.d/www.conf
[root@jiba php738]# cp php.ini-development /usr/local/php738/etc/php.ini
vim /usr/local/php738/etc/php-fpm.d/www.conf

把user group设置成 www

 

完工

[root@jiba php738]# php -version
PHP 7.3.8 (cli) (built: Aug 11 2019 00:53:25) ( NTS )
Copyright (c) 1997-2018 The PHP Group
Zend Engine v3.3.8, Copyright (c) 1998-2018 Zend Technologies

PHP这语言真是绝了!!!

 

你可能感兴趣的:(php)