Fatal error: Class 'XSLTProcessor' not found - but is installed

Fatal error: Class 'XSLTProcessor' not found - but is installed

当尝试执行以下操作时

$xsl = new XSLTProcessor();

我遇到了这个错误

Fatal error: Class 'XSLTProcessor' not found in

我看过 this question about this exact same error (and this one) 但我认为这是不同的。我说得对吗(我已经测试过了,似乎是)因为扩展详细信息显示在 phpinfo() 中,所以它确实安装正确?

是这样吗,还是无论是否安装成功,它都会一直显示在 phpinfo() 中?如果安装成功,您知道可能导致错误的原因是什么吗?

我已经尝试了多个版本的 PHP 并且我在 Azure 上托管并拥有 followed and checked the instructions here 的价值,这进一步让我相信扩展已正确安装。

您是如何在 Azure 上启用 php_xsl 扩展的?如果您手动将 DLL 库上传到 Azure 并通过 Configure via ini settings 部分进行配置 How to: Enable extensions in the default PHP runtime。可能是你配置的DLL库与PHP版本或OS版本不匹配。

但是,Azure Web Apps 已经在每个可用版本的 PHP 运行时的 ext 文件夹中包含 php_xsl.dll 库。但默认情况下,Azure PHP 运行时不启用它。您可以登录 Azure Web App 服务的 Kudu 控制台站点,并直接转到默认的 ext 文件夹,例如 D:\Program Files (x86)\PHP\v7.0\ext。您可以找到 Azure 提供的所有库。

因此,请删除您的旧配置,并尝试按照 How to: Enable extensions in the default PHP runtimeConfigure via ini settings 部分,在 extensions.ini 中添加配置:

extension=php_xsl.dll

如有任何疑问,请随时告诉我。