views:

58

answers:

1

Hi! I've decided to learn Symfony and right now I am reading through the very start of the "Practical Symfony" book. After reading the "Web Server Configuration" part I have a question.

The manual is describing how to correctly configure the server: browser should have access only to web/ and sf/.../ directories. The manual has great instructions regarding this and being a Linux user I had no problem following them and making everything work on my local machine. However that involves editing VirtualHost entries which normally is not easy to do on common shared hosting servers. So I wonder what is the common technique that Symfony developers use to get the same results in shared hosting environment? I think I can do that by adding "deny from all" in the root and then overwriting that rule in the allowed directories. However I am not sure if that's the easiest way and the way that is normally used.

A: 

If you can add files outside public_html directory, put all the directories there and put on the public_html directory all the files inside your web directory (put your sf directory if it was needed by your app), In this case only the web files are accessible on the public, however if you can only access the public_html directory and cannot add directory outside it, you can put all your files to a folder inside the public_html and secure it (I think .htaccess can do the trick), the web files should be in the public_html also but you must change the require_once(dirname(__FILE__).'/../config/ProjectConfiguration.class.php'); of your index.php to point to the new location of the ProjectConfiguration file.

But since this is a shared hosting environment, it is still possible that others may have access to your files but this is mostly on how the hosting provider setup their servers.

jmslouie
Thanks for the reply. I've also found this article which basically has the same approach.http://trac.symfony-project.org/wiki/InstallingSymfonyOnSharedHostNoSsh
Eugene