WDCP3.4面板安装PHP8.2.6是出现找不到相关模块解决方法

软件教程 admin 2024-03-25 09:56 146 0

sh lib/phps.sh

运行这个命令可以安装多版本PHP。选择8.2.6版本,运行到最后出错。

image.png

但实际上LIBSODIUM已经安装好了,看最后的提示,好像需要配置一个PKG路径,类似WINDOWS的全局环境变量吧。

在必应搜索,找到一篇文章。


在编译安装时,可能出现:


No package '**' found

 

Consider adjusting the PKG_CONFIG_PATH environment variable if you

installed software in a non-standard prefix.

 

Alternatively, you may set the environment variables OPENSSL_CFLAGS

and OPENSSL_LIBS to avoid the need to call pkg-config.

See the pkg-config man page for more details.

** 处显示的是 package 名,缺少某个 库/模块 则会显示其名称。


可通过 pkg-config --list-all 命令查看 package:


$ pkg-config --list-all

libecpg           libecpg - PostgreSQL libecpg library

libpng16          libpng - Loads and saves PNG files

libpq             libpq - PostgreSQL libpq library

oniguruma         oniguruma - Regular expression library

libpgtypes        libpgtypes - PostgreSQL libpgtypes library

libpcreposix      libpcreposix - PCREPosix - Posix compatible interface to libpcre

libxslt           libxslt - XSLT library version 2.

libzip            libzip - library for handling zip archives

libcurl           libcurl - Library to transfer files with ftp, http, etc.

libpng            libpng - Loads and saves PNG files

libmemcached      libmemcached - libmemcached C/C++ library.

libxml-2.0        libXML - libXML library version2.

libevent_core     libevent_core - libevent_core

libpcrecpp        libpcrecpp - PCRECPP - C++ wrapper for PCRE

libidn2           libidn2 - Library implementing IDNA2008 and TR46

openssl           OpenSSL - Secure Sockets Layer and cryptography libraries and tools

...

如果已经安装了提示的 库/模块,则需要手动添加 PKG_CONFIG_PATH;否则正常安装即可。


例如,已安装 openssl,但是编译 php7 时提示 “No package 'openssl' found”。


进入已安装的 库/模块 根路径,然后进入 lib/pkgconfig 目录,


$ cd lib/pkgconfig/

$ ls

libcrypto.pc libssl.pc openssl.pc

将 *.pc 文件软链到 /usr/local/lib/pkgconfig 目录下,然后再查看 pkg 列表里是否有了 openssl :


$ ln -s openssl.pc /usr/local/lib/pkgconfig/

$ pkg-config --list-all

如果出现在了列表里,则完成了。


没有出现,则需要配置 PKG_CONFIG_PATH


$ vim ~/.bash_profile 

 

PKG_CONFIG_PATH=$PKG_CONFIG_PATH:/usr/local/lib/pkgconfig                        

export PKG_CONFIG_PATH

编辑添加后,让其立即生效:


$ source ~/.bash_profile

 

$ pkg-config --list-all

然后再查看 库/模块 管理列表,出现在列表中,则可继续编译...


也可能会存在 库/模块 安装目录中没有 pkgconfig/*.pc


最后重新安装PHP8.2.6,提示成功。


image.png


即使在虚拟机测试成功了,也没有计划在真实服务器环境部署。因为WORDPRESS6.4.3在对环境要求比较高,考虑在虚拟机访问速度不流畅。云服务器配置更低,可能得不偿失。另外也担心影响现有网站的运行。

评论区