【发布时间】:2016-04-27 16:39:28
【问题描述】:
我有一个在 Azure 应用服务上运行的 web 应用。我正在尝试在 Kudu Debug CMD 控制台中测试部署后脚本。
php -d extension=php_redis.dll -f postdeploy.php
这是我的 postdeploy.php 文件
<?php
ini_set('error_reporting', -1);
ini_set("display_errors", 1);
function exception_handler($exception) {
echo "Uncaught exception: " , $exception->getMessage(), "\n";
}
set_exception_handler('exception_handler');
$redis = new Redis();
...
?>
我收到以下错误
Fatal error: Class 'Redis' not found in D:\home\site\deployments\tools\PostDeploymentActions\postdeploy.php on line 13
PHP Warning: PHP Startup: Unable to load dynamic library 'D:\Program Files (x86)\PHP\v5.6\ext\php_redis.dll' - The specified module could not be found.
in Unknown on line 0
我将正确版本的 php_redis.dll 上传到 PostDeploymentActions 文件夹。这与 web 应用程序通过门户 PHP_EXTENSIONS = bin\php_redis.dll 中的应用程序设置使用的二进制文件相同。但是,我不确定如何为此脚本加载它。
有没有办法可以在 Kudu 部署后脚本中加载 php_redis.dll?
我尝试了php -d extension=./php_redis.dll -f postdeploy.php、php -d extension=%~dp0php_redis.dll -f postdeploy.php 和其他奇怪的组合,但没有成功。
【问题讨论】:
-
作为第一步,我建议按照this document 隔离到更简单的 Kudu 控制台场景。