• Welcome to LiuJason's Blog!

宝塔php8.2 手动安装xsl扩展教程 解决安装失败问题

Coding Projects Jason 23 hours ago 2 Views 0 Comments QR code of this page

在宝塔面板中,PHP 8.2 默认提供 XSL 扩展的一键安装总是失败,于是通过 手动编译安装来解决。以下是完整步骤:

1. 安装依赖库

XSL 扩展依赖 libxslt 和 PHP 开发工具,先安装:

# Ubuntu/Debian
sudo apt-get update
sudo apt-get install -y libxslt1-dev php-dev php-pear

# CentOS/RHEL
sudo yum install -y libxslt-devel php-devel

2. 进入 PHP 源码目录

宝塔面板安装 PHP 后,源码通常在/www/server/php/82/src/ext/xsl

cd /www/server/php/82/src/ext/xsl

3. 编译 XSL 扩展

执行以下命令:

# 准备编译环境
/www/server/php/82/bin/phpize

# 配置编译参数
./configure --with-php-config=/www/server/php/82/bin/php-config

# 编译并安装
make && make install

安装完成后,会在 PHP 扩展目录生成 xsl.so 文件。


4. 启用扩展

编辑 PHP 配置文件/www/server/php/82/etc/php.ini 尾部添加extension=xsl.so


5. 重启 PHP 服务 和 验证安装

在宝塔面板中重启 PHP 8.2,执行php -m | grep xsl


注意事项

  • 如果 phpize 报错,可能缺少 php8.2-dev,请安装。
  • 如果编译时报 libxslt 找不到,请确认依赖库已安装。
  • 宝塔面板路径可能因版本不同略有差异,请根据实际情况调整。

 


This article is under CC BY-NC-SA 4.0 license.
Please quote the original link:https://www.liujason.com/article/1304.html
Like (0)
发表我的评论
取消评论

表情 贴图 加粗 删除线 居中 斜体 签到

Hi,您需要填写昵称和邮箱!

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址