Problems Hosting Symfony 1.2 (!) sites on Godaddy?

March 17, 2009 – 9:58 am

If you’re trying to deploy a Symfony 1.2 site on Godaddy, you may run into some issues that are not remedied by my previous post (which was limited to Symfony 1.0).

The main error you might get looks something like:
Empty module and/or action after parsing the URL “/frontend_dev.php” (/).

To remedy this, you need to edit the factories.yml and add a parameter to the request params, like so:

all:
  request:
    param:
      path_info_key: REQUEST_URI

(Do not confuse this with the “routing” settings that are already in the file. The “request” settings are commented out in the bottom, so you may not see them right away, and the code above just changing the default path_info_key from PATH_INFO to REQUEST_URI. Just add it below the “routing” settings, on the same indentation level.)

After this is done things may still not work. What I found is that Godaddy adds the script filename to the beginning of the $_SERVER["REQUEST_URI"] variable. This is different from most other hosts I’ve encountered, and it confuses symfony. And me.

So here’s a hack around that. In the /config/ProjectConfiguration.class.php add the following command to the top of the file:

$_SERVER["REQUEST_URI"] = str_replace($_SERVER["SCRIPT_NAME"], "", $_SERVER["REQUEST_URI"]);

All this does is remove the script name from the REQUEST_URI before symfony bootstraps. Simple but effective.

That should do the trick,
happy shared hosting!

Addendum:
Hang from Flying Bug blog just posted some other interesting godaddy tweaks and corrected an indentation error in my original post. Much appreciated - go check out his blog as well: http://xiehang.com/blog/2009/07/03/symfony-and-godaddy/


Filed under: Symfony — Tags: , — by Richtermeister

Powered by WordPress