Skip to content

Symfony and My Network Configuration

I’ve been trying to learn the Symfony framework on my local test environment. Symfony provides a lot of the same skeletal generation of code in PHP as Rails does to Ruby, thus making the process of coding a bit faster. Plus, it creates a cleaner, easier-to-read alternative to straight PHP coding.

When trying to test my pages in the Symfony’s development environment, I get the following error: You are not allowed to access this file. Check app_dev.php for more information.

After some research I found the problem had to do with my network configuration. In my case my test server is not on my workstation, but a separate test server that I had set up on my network. The default code generated by Symfony only allows individuals to access the development environment pages from locally on the server. Since I’m accessing my web server from an outside machine on my network, Symfony will not let that fly. At least not with the code it has generated.

To remedy the situation I had to to edit my app_dev.php file underneath the web folder. The IP address of my workstation is and I added it to the script like so:

// 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 (!in_array(@$_SERVER[‘REMOTE_ADDR’], array(‘’, ‘::1’, ‘’)))
die(‘You are not allowed to access this file. Check ‘.basename(__FILE__).’ for more information.’);


$configuration = ProjectConfiguration::getApplicationConfiguration(‘app’, ‘dev’, true);

Published inThoughts


  1. Karl Holodnick Karl Holodnick

    Stefan, WTF???

  2. xeVi xeVi

    Nice job! I had the same problem and i was fighting with file permissions! Thanks!

  3. You’re welcome. I’m glad this could be of help to you.

  4. Lucas Lucas

    Thanks (:

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.