首页 > 系统相关 >(麒麟Linux+PHP8+KingBase)麒麟Linux系统安装PHP8及人大金仓KingBase应用

(麒麟Linux+PHP8+KingBase)麒麟Linux系统安装PHP8及人大金仓KingBase应用

时间:2024-07-08 09:42:02浏览次数:12  
标签:enable -- KingBase devel PHP8 install Linux php8 php

一、PHP8安装

1.1 环境

CPU内核:aarch64

OS:麒麟V10 4.19.90-23.34.v2101.ky10

Web中间件: 东方通THS/V6

php : 8.2.0

db: KingbaseES V8R6

1.2 下载

https://www.php.net/releases/

下载地址:https://www.php.net/distributions/php-8.2.0.tar.gz

1.3 解压

cd /opt
sudo tar -zxvf php-8.2.0.tar.gz   #解压
sudo mv php-8.2.0 php8  #将解压后的目录php-8.2.0 重命名为 php8
cd  php8

1.4 安装依赖

接下来的编译过程可能多多少少会遇到一些问题,基本上是缺少依赖,逐个解决就可以了,直到编译通过为止。

编译配置的时候,这里如果某些依赖包没有安装好,就会遇到很多 configure error,安装相关软件开发包即可;以下为可能需要安装的包:

yum -y install libxml2-devel
yum -y install  openssl-devel
yum -y install sqlite-devel/sqlite3-devel
yum -y install bzip2-devel
yum -y install libcurl-devel
yum -y install gmp-devel
yum -y install oniguruma-devel
yum -y install readline-devel
yum -y install libxslt-devel
yum -y install libpng-devel
yum -y install libjpeg-devel
yum -y install freetype-devel

1.5 编译前配置

如果不需要原来的 PHP 版本,可以将编译配置中以下内容修改为单个 PHP 的设置

--prefix=/usr/local/php8 替换为 --prefix=/usr/local/php

--with-config-file-path=/etc/php8 替换为 --with-config-file-path=/etc/php

./configure \
--prefix=/usr/local/php8 \
--with-config-file-path=/etc/php8 \
--enable-fpm \
--with-fpm-user=apache  \
--with-fpm-group=apache \
--enable-inline-optimization \
--disable-debug \
--disable-rpath \
--enable-shared  \
--enable-soap \
--with-libxml-dir \
--with-xmlrpc \
--with-openssl \
--with-mcrypt \
--with-mhash \
--with-pcre-regex \
--with-sqlite3 \
--with-zlib \
--enable-bcmath \
--with-iconv \
--with-bz2 \
--enable-calendar \
--with-curl \
--with-cdb \
--enable-dom \
--enable-exif \
--enable-fileinfo \
--enable-filter \
--with-pcre-dir \
--enable-ftp \
--enable-gd \
--with-jpeg  \
--with-gettext \
--with-freetype \
--with-openssl-dir \
--with-jpeg-dir \
--with-png-dir \
--with-zlib-dir  \
--with-freetype-dir \
--enable-gd-native-ttf \
--enable-gd-jis-conv \
--with-gettext \
--with-gmp \
--with-mhash \
--enable-json \
--enable-mbstring \
--enable-mbregex \
--enable-mbregex-backtrack \
--with-libmbfl \
--with-onig \
--enable-pdo \
--with-mysqli=mysqlnd \
--with-pdo-mysql=mysqlnd \
--with-zlib-dir \
--with-pdo-sqlite \
--with-readline \
--enable-session \
--enable-shmop \
--enable-simplexml \
--enable-sockets  \
--enable-sysvmsg \
--enable-sysvsem \
--enable-sysvshm \
--enable-wddx \
--with-libxml-dir \
--with-xsl \
--enable-zip \
--with-zip \
--enable-mysqlnd-compression-support \
--with-pear \
--enable-opcache

**配置过程中的报错和解决办法

  1. libxml依赖错误

错误:

checking for libxml-2.0 >= 2.9.0... no

configure: error: Package requirements (libxml-2.0 >= 2.9.0) were not met:

Package 'libxml-2.0', required by 'virtual:world', not found

解决:

sudo dnf install libxml2-devel

 

  1. openssl依赖错误

错误:

checking for openssl >= 1.0.2... no

configure: error: Package requirements (openssl >= 1.0.2) were not met:

Package 'openssl', required by 'virtual:world', not found

解决:

sudo dnf install openssl-devel

 

  1. sqlite3依赖错误

错误:

checking for sqlite3 >= 3.7.7... no

configure: error: Package requirements (sqlite3 >= 3.7.7) were not met:

Package 'sqlite3', required by 'virtual:world', not found

解决:

sudo dnf install sqlite-devel

 

  1. sqlite3依赖错误

错误:

checking whether to enable bc style precision math functions... yes

checking for BZip2 support... yes

checking for BZip2 in default path... not found

configure: error: Please reinstall the BZip2 distribution

解决:

sudo dnf -y install bzip2-devel

 

  1. libcurl依赖错误

错误:

checking for libcurl >= 7.29.0... no

configure: error: Package requirements (libcurl >= 7.29.0) were not met:

Package 'libcurl', required by 'virtual:world', not found

解决:

sudo dnf -y install libcurl-devel

 

  1. gmp依赖错误

错误:

checking for __gmpz_rootrem in -lgmp... no

configure: error: GNU MP Library version 4.2 or greater required.

解决:

sudo dnf -y install gmp-devel

 

  1. oniguruma依赖错误

错误:

configure: error: Package requirements (oniguruma) were not met:

Package 'oniguruma', required by 'virtual:world', not found

解决:

sudo yum install oniguruma-devel

 

  1. readline 依赖错误

错误:

checking for libedit readline replacement... no

checking for readline support... yes

configure: error: Please reinstall readline - I cannot find readline.h

解决:

sudo yum -y install readline-devel

 

  1. libxslt 依赖错误

错误:

checking for libxslt >= 1.1.0... no

configure: error: Package requirements (libxslt >= 1.1.0) were not met:

Package 'libxslt', required by 'virtual:world', not found

解决:

sudo dnf -y install libxslt-devel

 
  1. libpng 依赖错误

错误:

checking for libpng... no

configure: error: Package requirements (libpng) were not met:

Package 'libpng', required by 'virtual:world', not found

解决:

sudo dnf -y install libpng-devel

 

  1. libjpeg 依赖错误

错误:

checking for libjpeg... no

configure: error: Package requirements (libjpeg) were not met:

Package 'libjpeg', required by 'virtual:world', not found

解决:

sudo dnf -y install libjpeg-devel

 

  1. freetype2 依赖错误

错误:

checking for freetype2... no

configure: error: Package requirements (freetype2) were not met:

Package 'freetype2', required by 'virtual:world', not found

解决:

sudo dnf -y install freetype-devel

 

  1. libzip 依赖错误

错误:

configure: error: Package requirements (libzip >= 0.11 libzip != 1.3.1 libzip != 1.7.0) were not met:

Package 'libzip', required by 'virtual:world', not found

解决:

sudo dnf -y install libzip-devel

 

1.6 编译安装

运行 make && make install 等待编译安装成功

如下为安装成功。

1.7 配置 php-fpm

mkdir /etc/php8
cp php.ini-production /etc/php8/php.ini
cp /usr/local/php8/etc/php-fpm.conf.default /usr/local/php8/etc/php-fpm.conf
cp /usr/local/php8/etc/php-fpm.d/www.conf.default /usr/local/php8/etc/php-fpm.d/www.conf
cp sapi/fpm/init.d.php-fpm /etc/init.d/php8-fpm
chmod +x /etc/init.d/php8-fpm


#如果不需要原来的 PHP 版本,可以将编译配置中以下内容修改为单个 PHP 的设置
/usr/local/php8 替换为 /usr/local/php
/etc/php8 替换为 /etc/php
php8-fpm 替换为 php-fpm

一般安装完成后 /etc/php8/这个目录是不存在的,执行以下这条复制命令会报这个错:需要创建这个php8目录

sudo cp php.ini-production /etc/php8/php.ini

cp: cannot create regular file '/etc/php8/php.ini': No such file or directory

1.8 设置php-fpm用户

#编辑文件
sudo vim /usr/local/php8/etc/php-fpm.d/www.conf

user = nginx    
group = nginx
listen = 127.0.0.1:9000

#修改为
user = apache 
group = apache
listen = 127.0.0.1:9000

1.9 启动php-fpm

/etc/init.d/php8-fpm start/stop/restart

在服务器端(东方通THS/Nginx)站点创建一个php文件info.php。打印phpinfo();

浏览器输入:http://192.168.0.100/info.php,当前的php版本是8.2。

 

二、添加人大金仓数据驱动php扩展

2.1 下载人大金仓php驱动

下载 https://www.kingbase.com.cn/downdriven/index.htm

https://kingbase.oss-cn-beijing.aliyuncs.com/KES/09-gd-jkqd/PHP/AARCH/NTS/v8r6_pdo_kdb_for_php-8.2.0_aarch64_uzts.tar.gz

2.2 添加扩展

#将人大金仓kingbase的php的数据库驱动文件拷贝到扩展目录下
cp pdo_kdb.so /usr/local/php8/lib/php/extensions/no-debug-non-zts-20220829/

#编辑文件,添加扩展
sudo vim /etc/php8/php.ini
extension=pdo_kdb

配置完成,重启php8-fpm

/etc/init.d/php8-fpm restart

浏览器测试打印php信息,pdo_kdb已经添加成功了。

 

标签:enable,--,KingBase,devel,PHP8,install,Linux,php8,php
From: https://www.cnblogs.com/fengguozhong/p/18289293

相关文章

  • centos8(linux): 安装使用supervisor管理laravel队列
    一,什么是supervisorSupervisor是一个进程控制系统,它使用户能够监视和控制类unix操作系统进程。它通过提供基于配置或事件启动、停止和重新启动进程的机制,帮助管理应该在系统中连续运行的进程。对于需要控制和监视Linux或其他类unix操作系统上多个进程的状态的开发人员和系统管理......
  • Linux系统配置Opencv+cuda+ffmpeg开发环境,-217:Gpu API call unknown error code问题
    Opencv是当前比较热门的图像处理开源算法库,但是随着深度学习在图像存储里领域的大放异彩,基于python的图像处理和深度学习算法大有超越opencv的趋势。opencv在最近的版本更新中,重点都放在了人工智能算法方面,本文介绍linux环境下配置支持GPU/cuda的ffmpeg和opencv开发环境,并将其中遇......
  • [Linux]
    端口范围1~65535知名端口(Well-KnownPorts):范围:0-1023用途:分配给常用的服务和协议(如HTTP、FTP、SSH等)。这些端口通常由系统或根用户使用。示例:HTTP:80HTTPS:443FTP:21SSH:22注册端口(RegisteredPorts):范围:1024-49151用途:分配给用户或注册的网络服务......
  • CentOS版Linux安装python
    在CentOS系统上安装Python3.8可以通过以下步骤完成:首先,打开终端。下载Python3.8的源代码:wget  https://www.python.org/ftp/python/3.8.0/Python-3.8.0.tgz解压下载的源码包:cd到Python-3.8.0.tgz的目录tarxzvfPython-3.8.0.tgz安装必要的构建工具和依赖项:sudoyu......
  • linux 下好用的 pdf 阅读器(不支持标注)
    安装,$sudoapt-getinstallzathura类似Vim的快捷键,普通浏览模式J:下翻一页K:上翻一页h,k,j,lCtrl+t,Ctrl+y:左右滚动半页Ctrl+d,Ctrl+u:上下滚动半页t,y:左右滚动一页Ctrl+f,Ctrl+b:上下滚动一页space,:上下滚动一页......
  • 学习Linux LVM,这篇文章就够了
      (1)引言     LVM(LogicalVolumeManager)逻辑卷管理,是在硬盘分区和文件系统之间添加的一个逻辑层,为文件系统屏蔽下层硬盘分区布局,并提供一个抽象的盘卷,在盘卷上建立文件系统。管理员利用LVM可以在硬盘不用重新分区的情况下动态调整文件系统的大小,并且利用LVM管理的......
  • xftp实现linux服务器传输文件
    1.xftp下载网址:https://www.xshell.com/zh/free-for-home-school/,下载后下一步安装即可 2.ipaddrshow查看ip地址,配置xftp连接服务器,找到对应路径传输文件   ......
  • Linux驱动之利用STM32、设备树、pwm子系统实现风扇的分级调控
    Linux驱动之利用STM32、设备树、pwm子系统实现风扇的分级调控系统:Linux5.10.61开发板:STM32mp157a硬件:风扇一、首先我们需要对PWM和定时器(TIM)的联系简单的做一下了解,具体详细的PWM原理可见PWM原理PWM频率与占空比详解。​PWM(脉宽调制)和TIM(定时器)在嵌入式系统中有着......
  • Linux系统之 — 线程
    Linux系统之—线程线程介绍线程使用死锁(Deadlock)竞态条件(RaceCondition)线程使用示例服务器端代码示例服务器端示例拆解1.引入头文件和宏定义2.定义全局变量3.定义线程函数4.主函数5.错误处理和资源释放客户端代码示例客户端示例拆解1.引入必要的头文件2.定......
  • RedHat7.4—配置远程管理Linux服务器
    公司的Linux服务器需24小时不间断工作,维护工程师希望通过设置能远程管理和维护服务器。要求通过SSH及VNC远程管理,实现如下配置需求:可以通过SSH服务访问远程主机,可以使用证书登录远程主机,不需要输入远程主机的用户名和密码可以使用VNC服务访问远程主机,使用图形界面访问,桌面端口......