从本地主机以外的其他地址访问Symfony/web/config.php? [英] Access Symfony/web/config.php from other address than localhost?

查看:60
本文介绍了从本地主机以外的其他地址访问Symfony/web/config.php?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我目前正在测试不同的PHP框架,以查看我的下一个项目要使用的巫婆.我刚刚在Web服务器上安装了Symfony2.尝试访问Symfony/web/config.php文件时,Symfony阻止此文件被除localhost外的任何文件编辑.治愈方法上,我的服务器上没有gui,因此如果没有浏览器,则视觉配置非常无用.

I'm currently testing different PHP frameworks to see witch on my going to use for my next project. I just installed Symfony2 on my web server. When trying to access the Symfony/web/config.php file, Symfony blocks this file from being edited by any other than localhost. Of cures there is no gui on my server, so a visual config is quite usless without a browser.

是否可以从loclhost以外的任何其他地址调用访问Symfony/web/config.php文件?

Is there a way to call access the Symfony/web/config.php file from any other address than loclhost?

推荐答案

您可以将自己的主机添加到该配置中,以便可以使用浏览器将其打开.

You can add your own host to that configuration so you can open it with your browser.

为此,请添加您的主机(即您的公共WAN IP,例如 config.php 文件.它是主机名的数组,请参见我自己的IP" 示例条目:

To do so, add your host (that is your public WAN IP, e.g. you can google it) into the config.php file. It's the array of hostnames on top, see the 'my very own ip' example entry:

if (!in_array(@$_SERVER['REMOTE_ADDR'], array(
    '127.0.0.1',
    '::1',
    'my very own ip',
))) {
    header('HTTP/1.0 403 Forbidden');
    die('This script is only accessible from localhost.');
}

然后,您应该能够访问服务器上的脚本.

You should then be able to access the script on your server.

这篇关于从本地主机以外的其他地址访问Symfony/web/config.php?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆