如何在 Heroku 上获取 Xdebug 运行?
How to get Xdebug running on Heroku?
我刚刚将一个新部署推送到 Heroku 上的临时实例,但失败了,现在我的站点收到 500 错误。
composer.json
{
"license": "proprietary",
"require": {
"php": ">=5.5.16",
"aws/aws-sdk-php": "2.*",
"ext-memcached": "*",
"ext-apcu": "*",
"ext-gd": "*",
"ext-gettext": "*",
"ext-mbstring": "*",
"ext-soap": "*",
"ext-mysql": "*",
"ext-xdebug": ">=2.4.0"
},
"require-dev": {
"heroku/heroku-buildpack-php": "*"
}
}
新PHP代码:
// STARTS DEBUG
xdebug_start_function_monitor(['session_start']);
register_shutdown_function(function() {
var_dump(xdebug_get_monitored_functions(), ini_get('session.auto_start'));
});
// ENDS DEBUG
Heroku 构建日志:
-----> PHP app detected
-----> Bootstrapping...
-----> Installing platform packages...
- php (5.5.38)
- ext-gd (bundled with php)
- ext-gettext (bundled with php)
- ext-mbstring (bundled with php)
- ext-mysql (bundled with php)
- ext-soap (bundled with php)
- ext-apcu (4.0.11)
- ext-memcached (2.2.0)
- apache (2.4.20)
- nginx (1.8.1)
! WARNING: Your 'composer.lock' is not up to date with the latest
changes in 'composer.json'. To ensure you are not getting stale
dependencies, run 'composer update' on your machine and commit
any changes to Git before pushing again.
-----> Installing dependencies...
Composer version 1.2.2 2016-11-03 17:43:15
Loading composer repositories with package information
Installing dependencies from lock file
Warning: The lock file is not up to date with the latest changes in composer.json. You may be getting outdated dependencies. Run update to update them.
- Installing symfony/event-dispatcher (v2.6.1)
Loading from cache
- Installing guzzle/guzzle (v3.9.2)
Loading from cache
- Installing aws/aws-sdk-php (2.7.12)
Loading from cache
Generating optimized autoload files
-----> Preparing runtime environment...
-----> Checking for additional extensions to install...
- New Relic detected, installed ext-newrelic
-----> Discovering process types
Procfile declares types -> web
-----> Compressing...
Done: 112.1M
-----> Launching...
Released v792
https://XXX.herokuapp.com/ deployed to Heroku
据我从构建日志中可以看出,它失败的原因是因为没有安装 Xdebug,即使我在 composer.json.
中指定了它
如何在 Heroku 上安装 Xdebug?
Heroku 似乎不支持 Xdebug。 Heroku 的文档提供 six lists of extensions:
- PHP 5.5 和 5.6 的三个列表:
- 自动启用的内置扩展程序
- 可以通过
composer.json
启用的内置扩展
- 可以通过
composer.json
启用的第三方扩展
- PHP7
的三个对应列表
None 其中列出了 Xdebug。
我刚刚将一个新部署推送到 Heroku 上的临时实例,但失败了,现在我的站点收到 500 错误。
composer.json
{
"license": "proprietary",
"require": {
"php": ">=5.5.16",
"aws/aws-sdk-php": "2.*",
"ext-memcached": "*",
"ext-apcu": "*",
"ext-gd": "*",
"ext-gettext": "*",
"ext-mbstring": "*",
"ext-soap": "*",
"ext-mysql": "*",
"ext-xdebug": ">=2.4.0"
},
"require-dev": {
"heroku/heroku-buildpack-php": "*"
}
}
新PHP代码:
// STARTS DEBUG
xdebug_start_function_monitor(['session_start']);
register_shutdown_function(function() {
var_dump(xdebug_get_monitored_functions(), ini_get('session.auto_start'));
});
// ENDS DEBUG
Heroku 构建日志:
-----> PHP app detected
-----> Bootstrapping...
-----> Installing platform packages...
- php (5.5.38)
- ext-gd (bundled with php)
- ext-gettext (bundled with php)
- ext-mbstring (bundled with php)
- ext-mysql (bundled with php)
- ext-soap (bundled with php)
- ext-apcu (4.0.11)
- ext-memcached (2.2.0)
- apache (2.4.20)
- nginx (1.8.1)
! WARNING: Your 'composer.lock' is not up to date with the latest
changes in 'composer.json'. To ensure you are not getting stale
dependencies, run 'composer update' on your machine and commit
any changes to Git before pushing again.
-----> Installing dependencies...
Composer version 1.2.2 2016-11-03 17:43:15
Loading composer repositories with package information
Installing dependencies from lock file
Warning: The lock file is not up to date with the latest changes in composer.json. You may be getting outdated dependencies. Run update to update them.
- Installing symfony/event-dispatcher (v2.6.1)
Loading from cache
- Installing guzzle/guzzle (v3.9.2)
Loading from cache
- Installing aws/aws-sdk-php (2.7.12)
Loading from cache
Generating optimized autoload files
-----> Preparing runtime environment...
-----> Checking for additional extensions to install...
- New Relic detected, installed ext-newrelic
-----> Discovering process types
Procfile declares types -> web
-----> Compressing...
Done: 112.1M
-----> Launching...
Released v792
https://XXX.herokuapp.com/ deployed to Heroku
据我从构建日志中可以看出,它失败的原因是因为没有安装 Xdebug,即使我在 composer.json.
中指定了它如何在 Heroku 上安装 Xdebug?
Heroku 似乎不支持 Xdebug。 Heroku 的文档提供 six lists of extensions:
- PHP 5.5 和 5.6 的三个列表:
- 自动启用的内置扩展程序
- 可以通过
composer.json
启用的内置扩展
- 可以通过
composer.json
启用的第三方扩展
- PHP7 的三个对应列表
None 其中列出了 Xdebug。