简体   繁体   English

如何在PHP Symfony中连接到IP地址而不是localhost?

[英]How to connect to IP address instead of localhost in php Symfony?

In my project I'm using PHP Symfony. 在我的项目中,我正在使用PHP Symfony。 My problem is that I want to connect to my IP address in stead of localhost. 我的问题是我想代替本地主机连接到我的IP地址。 But I receive this error: 但我收到此错误:

You don't have permission to access /Symfony 1.1/web/app_dev.php/municipalite on this server. 您无权访问此服务器上的/ Symfony 1.1 / web / app_dev.php / municipalite。

Check your web/app_dev.php which contains checking of your IP and denying access when you're accessing from ip other than localhost. 检查您的web/app_dev.php ,其中包含对IP的检查以及从localhost以外的IP访问时拒绝访问。

You will have to add your IP to list of permitted IPs and it should work fine then. 您必须将您的IP添加到允许的IP列表中,然后才能正常工作。 I'm not sure about symfony 1.1 but in symfony 1.4 this part of file looks like that: 我不确定symfony 1.1,但在symfony 1.4中,文件的这一部分看起来像这样:

if (!in_array(@$_SERVER['REMOTE_ADDR'], array('127.0.0.1', '::1')))
{
  die('You are not allowed to access this file. Check '.basename(__FILE__).' for more information.');
}

so add your ip to array('127.0.0.1', '::1') array 因此将您的IP添加到array('127.0.0.1', '::1') array

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM