2016-11-26 45 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。