gpt4 book ai didi

php - 更改 Heroku PHP 应用程序的文档根目录

转载 作者:行者123 更新时间:2023-12-05 06:45:20 25 4
gpt4 key购买 nike

我正在创建一个 Yii 2 应用程序并在 Heroku 上试用

文档根目录应该是该应用程序的 web/文件夹

这是我试过的:

  • 在该应用程序的根目录中创建一个 Procfile
web:    sh www/config/web-boot.sh
  • 在配置文件夹中创建 web-boot.sh
    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 文件夹中,我创建了“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 crashed2014-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 22014-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,谢谢

更新

现在我尝试了另一种解决方案,我将这个包添加到我的 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 crashed2014-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 12014-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,所以我尝试将 composer php 版本更新为“>=5.5.11”,但是我遇到了另一个错误(老兄,现在是凌晨 4 点 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].

请帮帮我,谢谢

最佳答案

看起来您没有使用官方构建包,而是某种第三方构建包(检查 heroku config 并查找 BUILDPACK_URL)。

与维护者一起解决,或者更好,使用 Heroku 的官方 PHP 支持(heroku config:unset BUILDPACK_URL 并推送更改)。然后你的 Procfile 将工作(但你需要删除 composer.json 中的 heroku/heroku-buildpack-php 依赖项,或将其移动到require-dev).

关于php - 更改 Heroku PHP 应用程序的文档根目录,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24717176/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com