Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/heroku/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
在Heroku上部署PHP项目_Php_Heroku - Fatal编程技术网

在Heroku上部署PHP项目

在Heroku上部署PHP项目,php,heroku,Php,Heroku,我已经成功地在heroku上部署了我的PHP项目,但问题是每当我输入“heroku Open”以加载网页url时,我都会遇到以下错误: Forbidden You don't have permission to access / on this server. 我知道问题可能来自服务器配置、我的ht访问,甚至Apache配置,我已经尝试过进行各种更改,但到目前为止都没有成功,以下是heroku日志: 015-03-15T10:47:30.266691+00:00 heroku[api]:

我已经成功地在heroku上部署了我的PHP项目,但问题是每当我输入“heroku Open”以加载网页url时,我都会遇到以下错误:

 Forbidden
 You don't have permission to access / on this server.
我知道问题可能来自服务器配置、我的ht访问,甚至Apache配置,我已经尝试过进行各种更改,但到目前为止都没有成功,以下是heroku日志:

015-03-15T10:47:30.266691+00:00 heroku[api]: Release v2 created by x@x.x
2015-03-15T10:50:02.189549+00:00 heroku[api]: Scale to web=1 by x@x.x
2015-03-15T10:50:02.262334+00:00 heroku[api]: Deploy d388ddf by  x@x.x
2015-03-15T10:50:02.262334+00:00 heroku[api]: Release v3 created by x@x.x
2015-03-15T10:50:08.597918+00:00 heroku[web.1]: Starting process with command `vendor/bin/heroku-php-apache2`
2015-03-15T10:50:10.812072+00:00 app[web.1]: Starting php-fpm...
2015-03-15T10:50:10.620318+00:00 app[web.1]: Optimzing defaults for 1X dyno...
2015-03-15T10:50:10.802110+00:00 app[web.1]: 4 processes at 128MB memory limit.
2015-03-15T10:50:12.815707+00:00 app[web.1]: Starting httpd...
2015-03-15T10:50:13.132692+00:00 heroku[web.1]: State changed from starting to up
2015-03-15T10:50:38.639895+00:00 heroku[api]: Scale to web=1 by x@x.x
2015-03-15T10:50:49.465371+00:00 heroku[router]: at=info method=GET path="/" host=boiling-bastion-7861.herokuapp.com request_id=92b6872e-c060-4e06-8ede-5d44ea335ada fwd="175.140.77.229" dyno=web.1 connect=1ms service=3ms status=403 bytes=387
2015-03-15T10:50:49.465802+00:00 app[web.1]: 10.123.194.135 - - [15/Mar/2015:10:50:49 +0000] "GET / HTTP/1.1" 403 209 "-" "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/39.0.2171.99 Safari/537.36
2015-03-15T10:50:49.465396+00:00 app[web.1]: [Sun Mar 15 10:50:49.463558 2015] [autoindex:error] [pid 117:tid 140423049713408] [client 10.123.194.135:31742] AH01276: Cannot serve directory /app/: No matching DirectoryIndex (home.php) found, and server-generated directory index forbidden by Options directive
2015-03-15T10:50:49.907445+00:00 heroku[router]: at=info method=GET path="/favicon.ico" host=boiling-bastion-7861.herokuapp.com request_id=76865ea0-628f-426f-8bad-5507aa052fb4 fwd="175.140.77.229" dyno=web.1 connect=1ms service=5ms status=200 bytes=3964
2015-03-15T10:50:49.906266+00:00 app[web.1]: 10.123.194.135 - - [15/Mar/2015:10:50:49 +0000] "GET /favicon.ico HTTP/1.1" 200 3754 "-" "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/39.0.2171.99 Safari/537.36
2015-03-15T10:53:30.128901+00:00 heroku[router]: at=info method=GET path="/" host=boiling-bastion-7861.herokuapp.com request_id=56038276-5eb7-40ad-8615-cc695a72cdcb fwd="175.140.77.229" dyno=web.1 connect=1ms service=2ms status=403 bytes=387
2015-03-15T10:53:30.129676+00:00 app[web.1]: 10.91.13.225 - - [15/Mar/2015:10:53:30 +0000] "GET / HTTP/1.1" 403 209 "-" "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/39.0.2171.99 Safari/537.36
2015-03-15T10:53:30.129331+00:00 app[web.1]: [Sun Mar 15 10:53:30.128673 2015] [autoindex:error] [pid 102:tid 140423284651776] [client 10.91.13.225:15561] AH01276: Cannot serve directory /app/: No matching DirectoryIndex (home.php) found, and server-generated directory index forbidden by Options directive
2015-03-15T10:53:30.686329+00:00 heroku[router]: at=info method=GET path="/favicon.ico" host=boiling-bastion-7861.herokuapp.com request_id=9bfc7392-7f31-49ff-831a-55dbd0812914 fwd="175.140.77.229" dyno=web.1 connect=3ms service=4ms status=200 bytes=3964
2015-03-15T10:53:30.686175+00:00 app[web.1]: 10.91.13.225 - - [15/Mar/2015:10:53:30 +0000] "GET /favicon.ico HTTP/1.1" 200 3754 "-" "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/39.0.2171.99 Safari/537.36
2015-03-15T11:06:22.231815+00:00 heroku[router]: at=info method=GET path="/" host=boiling-bastion-7861.herokuapp.com request_id=3a2df217-758f-469c-884a-3f27072dda7d fwd="175.140.77.229" dyno=web.1 connect=4ms service=7ms status=403 bytes=387
2015-03-15T11:06:22.228756+00:00 app[web.1]: 10.93.25.70 - - [15/Mar/2015:11:06:22 +0000] "GET / HTTP/1.1" 403 209 "-" "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/39.0.2171.99 Safari/537.36
2015-03-15T11:06:22.228440+00:00 app[web.1]: [Sun Mar 15 11:06:22.227460 2015] [autoindex:error] [pid 104:tid 140423183963904] [client 10.93.25.70:29123] AH01276: Cannot serve directory /app/: No matching DirectoryIndex (home.php) found, and server-generated directory index forbidden by Options directive
2015-03-15T11:06:22.710597+00:00 heroku[router]: at=info method=GET path="/favicon.ico" host=boiling-bastion-7861.herokuapp.com request_id=ad006b2f-00fe-426e-81f0-e2a8d8e9e457 fwd="175.140.77.229" dyno=web.1 connect=1ms service=10ms status=200 bytes=3964
2015-03-15T11:06:22.709151+00:00 app[web.1]: 10.93.25.70 - -   [15/Mar/2015:11:06:22 +0000] "GET /favicon.ico HTTP/1.1" 200 3754 "-" "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/39.0.2171.99 Safari/537.36

可能的解决方案是什么?!感谢您的任何考虑…

Apache正在告诉您错误日志中的问题所在(为了可读性,我将其包装):

显然,您在
.htaccess
文件中的某个地方有
DirectoryIndex home.php
,但没有
home.php
,因此当您尝试转到
/
时,它找不到该文件(当您仅请求目录本身时,它将使用该文件,
/
),并列出目录内容(这不是您想要的)在默认配置中是不允许的

因此,您需要使用代码创建一个
home.php
,将其更改为
.htaccess
,以删除
DirectoryIndex
语句,从而使
index.php
/
index.html
(如果存在)获取服务,或者,如果您的
home.php
和其他所有内容不在项目的根目录中,而是在类似
public
web
的子目录中,则:


保存了我的一天,创建了
Procfile
文件,并通过添加上述指定的命令来设置文档根目录。注意:用于Laravel+Heroku我有该文件,但仍然有该错误,我不知道为什么这是将Symfony应用部署到Heroku的最佳答案
2015-03-15T10:50:49.465396+00:00 app[web.1]: [Sun Mar 15 10:50:49.463558 2015]
  [autoindex:error] [pid 117:tid 140423049713408] [client 10.123.194.135:31742]
  AH01276: Cannot serve directory /app/: No matching DirectoryIndex (home.php) found,
  and server-generated directory index forbidden by Options directive
web: vendor/bin/heroku-php-apache2 public/