我創建一個Yii的2應用程序,並試圖在Heroku更改文檔根目錄Heroku的PHP應用
文檔根目錄應該是應用程序的web /文件夾
這是我已經試過:
- 在該申請
web: sh www/config/web-boot.sh的根目錄下創建一個Procfile
- 創建config文件夾
echo "Include /app/www/config/httpd/*.conf" >> /app/apache/conf/httpd.conf touch /app/apache/logs/error_log touch /app/apache/logs/access_log tail -F /app/apache/logs/error_log & tail -F /app/apache/logs/access_log & export LD_LIBRARY_PATH=/app/php/ext export PHP_INI_SCAN_DIR=/app/www echo "Launching apache" exec /app/apache/bin/httpd -DNO_DETACH
- 從config文件夾web-boot.sh,我創造 「的httpd」 文件夾, 「default.conf」 文件夾內的
DocumentRoot "/app/www/web" <Directory "/app/www/web"> Options Indexes FollowSymLinks AllowOverride All Order allow,deny Allow from all </Directory>
當我部署應用程序時,出現此錯誤:
An error occurred in the application and your page could not be served. Please try again in a few moments. If you are the application owner, check your logs for details.
當我檢查日誌:
2014-07-12T20:23:08.476411+00:00 heroku[web.1]: State changed from starting to crashed 2014-07-12T20:23:06.313554+00:00 heroku[web.1]: Starting process with command `sh www/config/web-boot.sh` 2014-07-12T20:23:08.465571+00:00 heroku[web.1]: Process exited with status 2 2014-07-12T20:23:10.025168+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=richy-rich.herokuapp.com request_id=e4bb1124-5f2d-4a27-8df4-6fff9bc166b2 fwd="50.19.158.232" dyno= connect= service= status=503 bytes= 2014-07-12T20:41:49.308914+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=richy-rich.herokuapp.com request_id=5785ac83-c4fb-473e-b794-50ce491512c9 fwd="223.255.224.107" dyno= connect= service= status=503 bytes=
如何解決這一問題? 我不明白,Procfile可言,感謝
UPDATE
現在我試過另一種解決辦法,我這個包添加到我的composer.json
heroku/heroku-buildpack-php
,並改變了Procfile成:
web: vendor/bin/heroku-php-nginx web/
這一次,我得到這個錯誤:
2014-07-12T21:12:58.960392+00:00 app[web.1]: This program requires PHP 5.5.11 or newer; check your 'php' command. 2014-07-12T21:13:00.147518+00:00 heroku[web.1]: State changed from starting to crashed 2014-07-12T21:12:58.044158+00:00 heroku[web.1]: Starting process with command `vendor/bin/heroku-php-apache2 web/` 2014-07-12T21:13:00.136787+00:00 heroku[web.1]: Process exited with status 1 2014-07-12T21:13:08.648874+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=richy-rich.herokuapp.com request_id=a3bcc52d-2a7c-45ac-b21d-f856154d7e38 fwd="223.255.224.107" dyno= connect= service= status=503 bytes=
好像這是因爲我的PHP版本,因爲由Heroku上安裝的版本是5.5.10,所以我嘗試更新作曲家的PHP版本爲「> = 5.5.11」, 但我得到另一個錯誤(文,這是上午04點39分,我還沒有入睡,因爲所有這些錯誤的)
Problem 1 - The requested package php could not be found in any version, there may be a typo in the package name. Problem 2 - The requested package php could not be found in any version, there may be a typo in the package name. Problem 3 - Installation request for cebe/markdown 0.9.x-dev -> satisfiable by cebe/markdown[0.9.x-dev]. - cebe/markdown 0.9.x-dev requires php >=5.4.0 -> no matching package found. Problem 4 - Installation request for ezyang/htmlpurifier v4.6.0 -> satisfiable by ezyang/htmlpurifier[v4.6.0]. - ezyang/htmlpurifier v4.6.0 requires php >=5.2 -> no matching package found. Problem 5 - Installation request for swiftmailer/swiftmailer 5.2.x-dev -> satisfiable by swiftmailer/swiftmailer[5.2.x-dev]. - swiftmailer/swiftmailer 5.2.x-dev requires php >=5.2.4 -> no matching package found. Problem 6 - Installation request for swiftmailer/swiftmailer dev-master -> satisfiable by swiftmailer/swiftmailer[dev-master]. - swiftmailer/swiftmailer dev-master requires php >=5.2.4 -> no matching package found. Problem 7 - Installation request for yiisoft/yii2 2.0.0-beta -> satisfiable by yiisoft/yii2[2.0.0-beta]. - yiisoft/yii2 2.0.0-beta requires php >=5.4.0 -> no matching package found. Problem 8 - yiisoft/yii2 2.0.0-beta requires php >=5.4.0 -> no matching package found. - yiisoft/yii2-swiftmailer 2.0.0-beta requires yiisoft/yii2 * -> satisfiable by yiisoft/yii2[2.0.0-beta]. - Installation request for yiisoft/yii2-swiftmailer 2.0.0-beta -> satisfiable by yiisoft/yii2-swiftmailer[2.0.0-beta].
請kindy幫幫我,謝謝
感謝您的建議, 我讀過它的默認安裝在heroku中,所以我不需要安裝它。 但由於在heroku中安裝了php版本,仍然無法運行Procfile – user3833083
請重新閱讀我寫的內容。你顯然沒有運行常規的buildpack。如果你在你的應用中運行'heroku config',那麼'BUILDPACK_URL'的值是多少? – dzuelke
官方buildpack附帶PHP 5.5.11-5.5.14,所以它永遠不會說「這個程序需要PHP 5.5.11或更新版本,請檢查您的'php'命令。」在啓動時,它會拒絕'heroku/heroku-buildpack-php'作爲非開發依賴項推送。你幾乎肯定會運行一個第三方buildpack,它有不同的PHP版本和不同的行爲。你不能在那裏使用正式的buildpack的啓動命令,因爲它們都是不同的。 – dzuelke