银河麒麟V10服务器版本编译安装php7.2.12

上传tar包php-7.2.12.tar.gz

tar -zxvf php-7.2.12.tar.gz

cd php-7.2.12

./configure --prefix=/home/kookserver/php --with-config-file-path=/home/kookserver/php/etc --with-config-file-scan-dir=/home/kookserver/php/etc/php.d --enable-mysqlnd --with-mysqli=mysqlnd --with-pdo-mysql=mysqlnd --enable-fpm --with-fpm-user=www --with-fpm-group=www --with-gd --with-iconv --with-zlib --enable-xml --enable-shmop --enable-sysvsem --enable-inline-optimization --enable-mbregex --enable-mbstring --enable-ftp --with-openssl --enable-pcntl  --enable-sockets --with-xmlrpc --enable-zip --enable-soap --without-pear --with-gettext --enable-session --with-curl --with-jpeg-dir  --with-freetype-dir --enable-opcache --with-libxml-dir --with-png-dir --with-xpm-dir=/usr/lib64/ 

make && make install

添加mongodb扩展(http://pecl.php.net/package/mongodb)
tar -zxvf mongodb-1.8.2.tgz
cd mongodb-1.8.2
/home/kookserver/php/bin/phpize
./configure --with-php-config=/home/kookserver/php/bin/php-config
make && make install

配置文件的末尾加上extension=mongodb.so这一段,重启php服务

添加imap扩展

cd php-7.2.12/ext/imap

/home/kookserver/php/bin/phpize
./configure --with-php-config=/home/kookserver/php/bin/php-config

编译报错

configure: error: utf8_mime2text() has new signature, but U8T_CANONICAL is missing

需要安装 

libc-client libc-client-devel这两个包

但是麒麟V10自带的yum源没有找到,只能通过rpm包安装(https://centos.pkgs.org/

获取libc-client:

wget  https://download-ib01.fedoraproject.org/pub/epel/8/Everything/aarch64/Packages/l/libc-client-2007f-24.el8.aarch64.rpm

获取 libc-client-devel:

wget https://download-ib01.fedoraproject.org/pub/epel/8/Everything/aarch64/Packages/u/uw-imap-devel-2007f-24.el8.aarch64.rpm

注意:这里需要安装centos8版本的rpm包,不能选centos7,rpm安装7版本的libc-client包时找不到libcrypto.so和libssl.so,但是/usr/lib64下有这两个库文件

其实是因为麒麟V10自带的openssl版本是1.1.1d,而7版本的libc-client包适配的是1.0.2版本的openssl

rpm -ivh libc-client-2007f-24.el8.aarch64.rpm

rpm -ivh uw-imap-devel-2007f-24.el8.aarch64.rpm

继续编译,报错:cannot find imap library(libc-client.a)

ln -s /usr/lib64/libc-client.so /usr/lib/libc-client.so,该报错消失

再编译,会提示让你加一些 --参数,提示什么参数就加什么

我的是 ./configure --with-php-config=/home/kookserver/php/bin/php-config  --with-kerberos --with-imap-ssl

然后make && make install成功

配置文件的末尾加上extension=imap.so这一段,重启php服务

添加mcrypt扩展

 7.1以下版本默认自带mcrypt功能,7.2版本的ext下没有找到mcrypt目录

把7.0.11的编译包解压后,其中的ext/mcrypt拷贝到7.2.12的ext目录下进行编译

cd php-7.2.12/ext/mcrypt

/home/kookserver/php/bin/phpize
./configure --with-php-config=/home/kookserver/php/bin/php-config

编译报错:需要安装libmcrypt

centos系统可以通过yum install libmcrypt libmcrypt-devel mcrypt mhash

但是银河麒麟的yum源没有这些包,只能下载rpm包

wget https://download-ib01.fedoraproject.org/pub/epel/7/aarch64/Packages/l/libmcrypt-2.5.8-13.el7.aarch64.rpm

wget https://download-ib01.fedoraproject.org/pub/epel/7/aarch64/Packages/l/libmcrypt-devel-2.5.8-13.el7.aarch64.rpm

rpm -ivh libmcrypt-2.5.8-13.el7.aarch64.rpm

rpm -ivh libmcrypt-devel-2.5.8-13.el7.aarch64.rpm

继续编译

make && make install 成功

 配置文件的末尾加上extension=mcrypt.so这一段,重启php服务

原文地址:https://www.cnblogs.com/zhangdajin/p/14297593.html