0

I want to provide a dev-environment on the production server for my Symfony 1.4 projects. Reasons:

  • Allows me to get details of errors, etc.
  • It happens very often that I get different output on the prod-server and on my private development server. This is due to different server configuration, php extensions and available data.
  • Sometimes my client wants to see small changes quickly. I don't want to clear the cache until changes are available
  • The most important point: I want to be dead certain that no "cache-magic" is going on when problems occur on the production server.

A bad idea would be to make /frontend_dev.php accessible for everyone.

Also, I can't use sfGuard, since the dev-environment must be accessible regardless of whether I'm logged in or not.

I'm running my projects on Apache 2. Maybe there is a solution using htaccess.

Any ideas?

fishbone
  • 3,140
  • 2
  • 37
  • 50

2 Answers2

2

In frontend_dev.php just use HTTP authentication to protect the file

Or in .htaccess (or vhost file) you can do this to protect your frontend_dev.php script:

<FilesMatch "frontend_dev.php">
   AuthName "Restricted file"
   AuthType Basic
   AuthUserFile /path/to/file/.htpasswd
   require valid-user
</FilesMatch> 

EDIT: And if you're using the command symfony project:deploy production --go to deploy your project into production, be sure to change the rsync_exclude.txt file so it copies over the frontend_dev.php file too.

Flukey
  • 6,445
  • 3
  • 46
  • 71
1

You might have multiple _dev, _cache, _test environments so it's a good idea to make them accessible via a subdomain (verysecret.x.com) and the Restriction posted by @Flukey.