Installing Symfony on OVH
OVH is a well-know french host. This tutorial explains how to run a symfony app on a shared server with ovh, and can also be useful to people trying to install symfony on other shared hosts.
1 - OVH doesn't accept the magic_quotes_gpc and register_globals default settings and forbids modifications of theses properties. So you need to add a php.yml in the config/ directory with :
check: magic_quotes_gpc: on register_globals: on
2 - Warning: In the database.yml, the host (or hostspec) can't be localhost but sql# (the hostname given by OVH) and Creole must be installed (in lib/ by exemple - lib/creole and lib/jargon) if you don't use the sandbox.
3 - At OVH, the web root directory is "www". So rename your web directory to www/ and add in config/config.php
$sf_root_dir = sfConfig::get('sf_root_dir');
$sf_upload_dir_name = sfConfig::get('sf_upload_dir_name');
sfConfig::add(array(
'sf_web_dir_name' => $sf_web_dir_name = 'www',
'sf_web_dir' => $sf_root_dir.DIRECTORY_SEPARATOR.$sf_web_dir_name,
'sf_upload_dir' => $sf_root_dir.DIRECTORY_SEPARATOR.$sf_web_dir_name.DIRECTORY_SEPARATOR.$sf_upload_dir_name,
));
If it doesn't work and make a fatal error (Class 'sfConfig' not found), add these lines in /apps/myapp/config/config.php (for each application) instead of config/config.php.
4 - Modify the www/.htaccess mod_rewrite config:
SetEnv PHP_VER 5
Options +FollowSymLinks +ExecCGI
<IfModule mod_rewrite.c>
RewriteEngine On
# we skip all files with .something
RewriteCond %{REQUEST_URI} \..+$
RewriteCond %{REQUEST_URI} !\.html$
RewriteCond %{REQUEST_URI} !frontend_dev\.php
RewriteRule .* - [L]
# we check if the .html version is here (caching)
RewriteRule ^$ /index.html [QSA]
RewriteRule ^([^.]+)$ /$1.html [QSA]
RewriteCond %{REQUEST_FILENAME} !-f
# no, so we redirect to our front web controller
RewriteRule ^(.*)$ /index.php [QSA,L]
RewriteRule ^frontend_dev\.php/(.*)$ /frontend_dev.php [QSA,L]
</IfModule>
# big crash from our front web controller
ErrorDocument 500 "<h2>Application error</h2>symfony application failed to start properly"[QSA,L]
Be carefull to have the slash before index.php in your .htaccess rewrite rule
This should be enough since there is no more .php5 extension problem thanks to the "SetEnv PHP_VER 5" (Thanks Emriln).
(Tested on Horrors Of The Black Museum)
If "SetEnv PHP_VER 5" doesn't work :( , ignore step 4 above but continue as follows:
4 - Modify in apps/myapp/config/settings.yml the no_script_name option:
prod:
.settings:
no_script_name: off
5 - For the .php5 extension problem, see http://www.symfony-project.com/trac/ticket/813
6 - Rename index.php to index.php5
7 - Modify the www/.htaccess mod_rewrite config:
Options +FollowSymLinks +ExecCGI
<IfModule mod_rewrite.c>
RewriteEngine On
# we skip all files with .something
RewriteCond %{REQUEST_URI} \..+$
RewriteCond %{REQUEST_URI} !\.html$
RewriteCond %{REQUEST_URI} !\.php5
RewriteRule .* - [L]
# we check if the .html version is here (caching)
RewriteRule ^$ /index.html [QSA]
RewriteRule ^([^.]+)$ /$1.html [QSA]
RewriteCond %{REQUEST_FILENAME} !-f
# no, so we redirect to our front web controller
RewriteRule ^(.*)$ /index.php5 [QSA,L]
RewriteRule ^index\.php5/(.*)$ /index.php5 [QSA,L]
RewriteRule ^frontend_dev\.php5/(.*)$ /frontend_dev.php5 [QSA,L]
</IfModule>
# big crash from our front web controller
ErrorDocument 500 "<h2>Application error</h2>symfony application failed to start properly"
If a message "No input file specified." appears : (Discussion on Forum)
- Modify the www/.htaccess, by adding the line
mod_gzip_on Off

