我无法访问我的网站Symfony [您无权访问此文件]

M-B*_*NCH 10 php host symfony

我主持了我的网站; 一个Symfony2应用程序,当我尝试访问我的网站时,此消息显示.

You are not allowed to access this file. Check app_dev.php for more information
Run Code Online (Sandbox Code Playgroud)

链接是:

http://something.com/web/app_dev.php/
Run Code Online (Sandbox Code Playgroud)

当我尝试在生产模式下访问时,这是消息:

Fatal error: Class 'AppBundle\AppBundle' not found in /htdocs/app/AppKernel.php on line 19
Run Code Online (Sandbox Code Playgroud)

我没有这个文件夹htdocs/我的主机的

Mic*_*bov 23

您遇到了开发环境授权的问题.

如果你打开,app_dev.php你会看到下一个代码:

// This check prevents access to debug front controllers that are deployed by accident to production servers.
// Feel free to remove this, extend it, or make something more sophisticated.
if (isset($_SERVER['HTTP_CLIENT_IP'])
    || isset($_SERVER['HTTP_X_FORWARDED_FOR'])
    || !(in_array(@$_SERVER['REMOTE_ADDR'], array('127.0.0.1', 'fe80::1', '::1')) || php_sapi_name() === 'cli-server')
) {
    header('HTTP/1.0 403 Forbidden');
    exit('You are not allowed to access this file. Check '.basename(__FILE__).' for more information.');
}
Run Code Online (Sandbox Code Playgroud)

它充当了其他人的防御者,可以访问你的dev-env.

您可以将IP添加到可信IP列表中,所有这些都可以正常工作.代码中数组中定义的可信IP:

array('127.0.0.1', 'fe80::1', '::1')
Run Code Online (Sandbox Code Playgroud)