Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Access Symfony/web/config.php from other address than localhost?

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.

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

like image 827
wowpatrick Avatar asked Jun 17 '11 08:06

wowpatrick


2 Answers

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

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.

like image 72
hakre Avatar answered Oct 08 '22 02:10

hakre


If you are not sure from which ip you are connecting, use

var_dump($_SERVER['REMOTE_ADDR'])

like image 35
tom.tomsen Avatar answered Oct 08 '22 02:10

tom.tomsen