2016-11-26 47 views
2

我只是将一个新部署推送到Heroku上的暂存实例,该实例失败了,现在我从我的网站收到500错误。如何在Heroku上运行Xdebug?

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?

+0

它看起来像我的构建成功完成。 HTTP 500是一个通用的错误消息。你应该[检查你的应用程序日志](https://devcenter.heroku.com/articles/logging#log-retrieval),看看他们说什么。 – Chris

+0

@Chris我看了一下应用程序日志,它没有告诉我任何东西,但我已经确认它不工作的原因是因为XDebug没有安装(即使它是在作曲家中以.json)。我已确认XDebug确实没有安装此错误消息:致命错误:调用未定义的函数xdebug_start_function_monitor()in ...' –

+0

@Chris,我做过了,这是问题的第一部分。 –

回答

3

看起来Herde不支持Xdebug。 Heroku的文档提供six lists of extensions:为PHP 5.5

  • 三个列表和5.6:
    • 内置的扩展,会自动启用
    • 内置的扩展,可以通过composer.json
    • 第三 - 启用第三方扩展可以通过composer.json
  • 三个相应的对应PHP 7的打开列表

它们都没有列出Xdebug。