问题描述
我目前正在测试不同的 PHP 框架,以了解我将在下一个项目中使用的女巫.我刚刚在我的网络服务器上安装了 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,例如 你可以google一下)到config.php
文件.这是顶部的主机名数组,请参阅 'myvery own 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.
这篇关于从 localhost 以外的其他地址访问 Symfony/web/config.php?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!