5

For a bit of history - this is the first time I attempted to setup a test symfony project, just to have a play with it.

The symfony project was setup in the following location:

~/symfony_projects/myproject/

Now, with cpanel, the httpd.conf is automatically generated (but I'm sure you knew that), and it uses ~/public_html/ as the web root and splits it up by domain name (virtual hosts) - so for this example, lets say it's ~/public_html/example.com/.

So the symfony project is all setup now, the next problem was trying to figure out how to setup the server so it points to the /web part of the project - this is where I found it tricky.

I tried doing the following:

ln -sf ~/public_html/libs/Symfony/data/web/sf ~/symfony_projects/myproject/web/sf
ln -sf ~/symfony_projects/myproject/web/* ~/public_html/example.com

That unfortunately didn't work though. When trying to go to http://www.example.com it just gave me a 500 error.

Any other options here? Taking into consideration that I cannot modify the httpd.conf. And even if I could, it's auto-generated and would rather not (in cpanel).

* Update *

I just tried what was suggested by @Dan, but with the same issue - getting HTTP Error 500 (Internal Server Error). So, it looks like something else is the issue.

I checked my error_logs but didn't see anything useful there. Is there any other way I can check to see what the problem is?

* Another Update *

Just tried http://example.com/frontend_dev.php and it works perfectly - gives no errors at all, which makes it kind of hard to debug the production controller.

So the Development controller works flawlessly and the production is spitting out the 500 error - any ideas? :/

xil3
  • 16,305
  • 8
  • 63
  • 97

2 Answers2

1

I just copy everything out of web/ (including css/, js/, etc. subfolders) one level higher, then edit the index.php/yourapp_dev.php files' require statements to reflect the change in path. Add some rewrite rules to forbid direct access to the rest of the directories and you're all set on servers where you can't change the document root.

Dan Grossman
  • 51,866
  • 10
  • 112
  • 101
  • Nice work around, but as far as the rewrite rules, can you show me what you got for your .htaccess? – xil3 Feb 02 '11 at 09:26
  • Actually, I just tried that exactly, and got `HTTP Error 500 (Internal Server Error)` - same error as when I tried with the symbolic linking. I checked the error_log and it's not giving me any information. – xil3 Feb 02 '11 at 09:39
  • Have you created the log and cache directories, and given write permission? Is there anything in the log directory? – Dan Grossman Feb 02 '11 at 09:44
  • Yeah, log and cache have `777` permissions, and there's nothing in log. – xil3 Feb 02 '11 at 09:48
  • I'm reading that it spits out 500 by default for the production version (if there are any issues) - is there any way to switch on debugging in symfony? – xil3 Feb 02 '11 at 09:48
  • Access the development controller instead of the production controller, or change the environment to use in the file. – Dan Grossman Feb 02 '11 at 09:50
  • Yeah, I just went to `http://example.com/frontend_dev.php` and it works perfectly - no errors at all. But with the production one it gives the `500` error. I was expecting the development controller to tell me what the issue was... – xil3 Feb 02 '11 at 09:55
  • @xil3 When you say "the production one", are you going to `http://example.com/`, or `http://example.com/index.php`? – Matt Gibson Feb 02 '11 at 10:55
  • Tried both, but it seems to be working now after doing `php symfony doctrine:build --all` - quite odd that dev would work before that was done and prod didn't. – xil3 Feb 02 '11 at 11:02
  • Excellent timing here... I had the exact same question. However, can someone share the .htaccess settings for the rewrite rules? (first comment above) – Steve Perkins Feb 03 '11 at 15:30
0

If you look at the http.conf virtual host entry for the symfony project the last line in generally a commented out include statement. If you uncomment that line you add any extra virtual host configs you need into that file. Then just restart apache. Anything in the file will then be appended in place of the include statement.

xzyfer
  • 13,937
  • 5
  • 35
  • 46