rpm安装的mysql php_PHP-RPM 安装指南(亲测有用)

89570228560ae3c0df89a6e18708ddff.png

下载php

1 wget https://www.php.net/distributions/php-7.3.8.tar.gz

解压安装

1 tar -xvf php-7.3.8.tar.gz2

3 ./configure --prefix=/usr/local/php --with-config-file-path=/etc --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 --with-gettext --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-bz2 --with-readline --without-sqlite3 --without-pdo-sqlite --with-pear

然后可能会出现错误

cb6701d985e0a075cbd540674f7e7c5f.png

解决办法:

1 yum install libxml2-devel

查看是否成功

1 find / -name "xml2-config"

然后无限进行解压后的安装步骤,找错误,直到解决所有毛病的说,可能我遇到的,你没有遇到,也说不定,下面的错误解决方案只值得借鉴。。。(适不适合 那就不晓得了)

64ef6ded03dc4b8ec28ecbbe8ea6e9e7.png

解决办法  重新装下 curl

1 yum -y install curl-devel

e74496e1a7f5bc2821ec413c9c7cf600.png

解决办法

yum -y install libzip-devel

c7ce4253d80f6a9fd73d8c9b1ebc8e23.png

解决办法  这是由于系统的自带的 libzip版本低了,所以先卸载系统自带的libzip

yum -y remove libzip-devel

然后在官网下载并且编译安装

e5595ef71d4d8532039094cb6f8801bf.png

(由于1.5以及以上的安装方式和版本下的不同,所以这里还需要安装个东西)

yum -y install cmake

然后切回 local目录(版本可能更新了)

wget https://libzip.org/download/libzip-1.5.2.tar.xz

解压安装

1 tar xvf libzip-1.5.2.tar.xz2

3 cd libzip-1.5.2

4

5 mkdir build6

7 cd build8

9 cmake ..

此时,可能会发现 cmake版本低了

eed92f52b93df6d4b4d5aea71abf14f4.png

所以需要更新 cmake版本 (ε=(´ο`*)))唉)

cd /usr/local

首先先,移除 cmake

yum remove cmake

93f2ca4b8c8f6cf59b6a2aea7ef1aebd.png

下载 cmake最新版(自己找官网复制链接)

wget https://github.com/Kitware/CMake/releases/download/v3.15.2/cmake-3.15.2.tar.gz

解压

tar -xvf cmake-3.15.2.tar.gz

进入cmake3.15.2文件夹,安装

1 cd cmake-3.15.2

2

3 ./configure4

5 make6

7 make install

安装成功后,

下面添加cmake环境变量,编辑 /etc/profile.d/cmake.sh 文件,写入以下内容:

export CMAKE_HOME=/usr/local/cmake-3.15.2export PATH=$PATH:$CMAKE_HOME/bin

保存并退出,执行命令让cmake环境文件生效

source /etc/profile

此时,你再次查看cmake版本,就已经是3.15.2了

(django) [root@h1 cmake-3.15.2]#cmake --version

cmake version 3.15.2

再进行 libzip的安装

1 cd /usr/local/libzip-1.5.2

2

3 cd build4

5 cmake ..6

7 make && make install

安装完成

再进行 php 的安装测验

cd /usr/local/php-7.3.8./configure --prefix=/usr/local/php --with-config-file-path=/etc --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 --with-gettext --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-bz2 --with-readline --without-sqlite3 --without-pdo-sqlite --with-pear

d4ce89604bb6827e3bd8d9aa4de609e3.png

又可能出现问题(一个个接近呗)

解决方法

1 vim /etc/ld.so.conf2 #添加如下几行

3 /usr/local/lib644 /usr/local/lib5 /usr/lib6 /usr/lib647 #保存退出

8 :wq9 ldconfig -v #使之生效

0766125b8982c11b5185f386c66be309.png

编译php后发生warning:configure:WARNING:unrecognizedoptions:--with-mysql 只是php7版本不支持mysql模块

./configure --help 查看configure的正确语法,重新编译php支持mysql,改用--with-pdo-mysql

php7版本正确的编译语句是:

./configure --prefix=/usr/local/php --with-config-file-path=/usr/local/php/etc --enable-fpm --with-fpm-user=www --with-fpm-group=www --enable-mysqlnd --with-mysqli=mysqlnd --with-pdo-mysql=mysqlnd --enable-mysqlnd-compression-support --with-iconv-dir --with-freetype-dir --with-jpeg-dir --with-png-dir --with-zlib --with-libxml-dir --enable-xml --disable-rpath --enable-bcmath --enable-shmop --enable-sysvsem --enable-inline-optimization --with-curl --enable-mbregex --enable-mbstring --enable-intl --with-mcrypt --with-libmbfl --enable-ftp --with-gd --enable-gd-jis-conv --enable-gd-native-ttf --with-openssl --with-mhash --enable-pcntl --enable-sockets --with-xmlrpc --enable-zip --enable-soap --with-gettext --disable-fileinfo --enable-opcache --with-pear --enable-maintainer-zts --with-ldap=shared --without-gdbm

88f14ef7df22f5cc1a6f379a52973ecb.png

解决办法:

1 rpm -qa |grep libjpeg2 yum -y install libjpeg-devel3 yum list installed |grep libjpeg4 再次编译即可

f1d6aaec74536c95fed1c135474aa601.png

解决方法:

yum install -y libicu-devel

df120bd1c06b25ad881817a24efe2feb.png

解决方法

检查下面是不是已经安装,如果没有安装之:

检查:

1 yum list openldap2 yum list openldap-devel

安装 :

1 yum install openldap2 yum install openldap-devel

configure: error: Cannot find ldap libraries in /usr/lib

解决方法

cp -frp /usr/lib64/libldap* /usr/lib/

eb0689881a8fe78150f5174f091d8037.png

此时,发现换成7.3版本的编译指令

./configure --enable-fpm --prefix=/alidata/server/php7.3 --with-config-file-path=/alidata/server/php7.3/etc --with-curl --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 --enable-zip --with-zlib-dir=DIR --with-pcre-dir --with-libzip=DIR --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

c1da614446204c62eb87950ba3b23cae.png

解决办法

yum -y install libxslt libxslt-devel

514ddde03c0ee5637dcc12e574337934.png

终于成功!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! (总共出现了 12个问题)

然后再进入正题

编译

make

make install

8cb6701ef77a328606693702837088d3.png

注意这里,可以看出

php添加到环境变量中的应该为  /alidata/server/php7.3/bin/

配置环境变量(添加 PHP 命令到环境变量)

vim /etc/profile

在末尾加入

1 PATH=$PATH:/alidata/server/php7.3/bin/

2

3 export PATH

要使改动立即生效

. /etc/profile 或 source /etc/profile

查看环境变量

echo $PATH

查看php版本

(django) [root@h1 php-7.3.8]#php -v

PHP 7.3.8 (cli) (built: Aug 9 2019 21:27:07) ( NTS )

Copyright (c)1997-2018The PHP Group

Zend Engine v3.3.8, Copyright (c) 1998-2018Zend Technologies

(django) [root@h1 php-7.3.8]#

配置启动 php-fpm

1 Installing shared extensions: /alidata/server/php7.3/lib/php/extensions/no-debug-non-zts-20180731/

2 Installing PHP CLI binary: /alidata/server/php7.3/bin/

3 Installing PHP CLI man page: /alidata/server/php7.3/php/man/man1/

4 Installing PHP FPM binary: /alidata/server/php7.3/sbin/

5 Installing PHP FPM defconfig: /alidata/server/php7.3/etc/

6 Installing PHP FPM man page: /alidata/server/php7.3/php/man/man8/

7 Installing PHP FPM status page: /alidata/server/php7.3/php/php/fpm/

8 Installing phpdbg binary: /alidata/server/php7.3/bin/

9 Installing phpdbg man page: /alidata/server/php7.3/php/man/man1/

10 Installing PHP CGI binary: /alidata/server/php7.3/bin/

11 Installing PHP CGI man page: /alidata/server/php7.3/php/man/man1/

12 Installing build environment: /alidata/server/php7.3/lib/php/build/

13 Installing header files: /alidata/server/php7.3/include/php/

14 Installing helper programs: /alidata/server/php7.3/bin/

15 program: phpize16 program: php-config17 Installing man pages: /alidata/server/php7.3/php/man/man1/

18 page: phpize.1

19 page: php-config.1

由上图的安装信息可知,php-fpm在

cd /alidata/server/php7.3/etc

然后

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

启动 php-fpm

/alidata/server/php7.3/sbin/php-fpm

然后可能会出现问题

93c7968a07d20c5aa82c7f6c68a2d285.png

解决办法

(django) [root@h1 etc]#cd /alidata/server/php7.3/etc/php-fpm.d/

(django) [root@h1 php-fpm.d]#cp www.conf.default www.conf

(django) [root@h1 php-fpm.d]#/alidata/server/php7.3/sbin/php-fpm -t

[09-Aug-2019 21:45:42] NOTICE: configuration file /alidata/server/php7.3/etc/php-fpm.conf test is successful

于是 成功启动

d1f67563d8ddc743cbeafa082452d3cf.png

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值