[Tutorial] installing symfony for OVH [message #10307] |
Thu, 17 August 2006 12:58  |
Fred Messages: 10 Registered: August 2006 Location: France |
Junior Member |
|
|
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,
));
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]
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"
[Updated on: Fri, 18 August 2006 10:16] by Moderator
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| Re: [Tutorial] installing symfony for OVH [message #19149 is a reply to message #10307 ] |
Sun, 07 January 2007 22:48   |
Sylvio Messages: 58 Registered: May 2006 Location: Avignon, France |
Member |
|
|
Hi I have a problem with OVH too:
This website :
http://www.ehandicap-record.com/index.php work fine
but if I access it by :
http://www.ehandicap-record.com
All the Symfony generated url (for css, js, links, images, ...) are incorrect, they take the absolute path (???) instead of web path :
ex:
"/home/ehandica/www/css/main.css" instead of "/css/main.css"
"/home/ehandica/www/fr/contact/index.html" instead of "/fr/contact/index.html"
I don't manage to find the problem.
I use Symfony 1.0 Beta3
[Updated on: Sun, 07 January 2007 22:51] Sylvain Papet - Web Developper
Com-Océan / www.com-ocean.com
|
|
|
| Re: [Tutorial] installing symfony for OVH [message #19270 is a reply to message #19149 ] |
Mon, 08 January 2007 22:02   |
Sylvio Messages: 58 Registered: May 2006 Location: Avignon, France |
Member |
|
|
Resolved: it work by adding at the beginning of index.php :
$_SERVER['SCRIPT_NAME']='/index.php';
Sylvain Papet - Web Developper
Com-Océan / www.com-ocean.com
|
|
|
| Re: [Tutorial] installing symfony for OVH [message #20147 is a reply to message #19270 ] |
Mon, 22 January 2007 10:38   |
_k20_ Messages: 68 Registered: July 2006 |
Member |
|
|
Hi,
My symfony application, with ovh, don't work with this htaccess file (error 404). I deleted all exept SetEnv PHP_VER 5, and now it works.
!
[Updated on: Thu, 25 January 2007 14:51]
|
|
|
|
|
| Re: [Tutorial] installing symfony for OVH [message #29507 is a reply to message #10307 ] |
Sat, 16 June 2007 03:45   |
amsmams Messages: 69 Registered: May 2007 Location: Dakar, Sénégal. Africa |
Member |
|
|
Hello,
I have a 240plan on OVH.
I have follow the tutorial but i got this error?
Fatal error: Class 'sfConfig' not found in home.10.9/myaccount/config/config.php on line 8.
I use the sandbox for this application.
Thanks for any help.
[Updated on: Sat, 16 June 2007 03:46]
|
|
|
|
| Re: [Tutorial] installing symfony for OVH [message #33356 is a reply to message #10307 ] |
Tue, 14 August 2007 12:35   |
Nab4 Messages: 11 Registered: May 2007 |
Junior Member |
|
|
After deploying a few applications on OVH here's what I learned from it :
1 - using "check" for magic_quotes_gpc and register_globals doesn't remove the warning, which is a bit annoying in dev and fills up logs with useless lines in prod. You can disable it by adding this to config/php.yml :
warn:
register_globals: 1
magic_quotes_gpc: 1
2 - On shared hosting, you can't send emails using smtp, the only possibility is to use the mail() command. So you need to specify it to symfony by adding this line to mailer.yml (in apps/name/module/config/ folder)
Don't add any other thing (no smtp name, login, pass... nothing).
And another thing on shared hosting, you cannot use shell or php scripts to send emails periodically, only way is to go through a web page (due to OVH shared hosting architecture, scripts and php called from apache are executed in a totally different environment, one allowing mails through mail(), the other blocking all emails)
3 - no_script_name can cause problems with URL, this seems to be caused by the apache gzip module having trouble with symfony URL (sometimes it can't find the data to compress), you can disable this module by adding this to the .htaccess file in your www directory :
<IfModule mod_gzip.c>
mod_gzip_on Off
</IfModule>
|
|
|
| Re: [Tutorial] installing symfony for OVH [message #55075 is a reply to message #10307 ] |
Sat, 28 June 2008 10:45   |
gregoire_m Messages: 50 Registered: May 2008 Location: France |
Member |
|
|
Hi,
First, big thanks for this procedure 
I've spent my evening yesterday trying to install my symfony project on my new OVH server... I've subscribed to the "90 plan" offer, and followed this tuto, but whatever I do, I finish on this page :
Application error
symfony application failed to start properly"[QSA,L]
I've tried without freezing my project (twice), and with freezing it, same result...
Here is the files tree of my home:
apps/
batch/
cache/
cgi-bin/
config/
data/
doc/
lib/
log/
plugins/
requetes/
symfony
symfony.php
symfony_project/ (that's the source of symfony 1.0.16)
test/
www/
In addition, when I execute the symfony command using ssh, I get this error :
$ ./symfony
X-Powered-By: PHP/4.4.8
Content-type: text/html
<br />
<b>Parse error</b>: syntax error, unexpected T_STATIC, expecting T_OLD_FUNCTION or T_FUNCTION or T_VAR or '}' in <b>/home.10.34/humourpoa/data/symfony/bin/symfony.php</b> on line <b>42</b><br />
Does somebody see something I missed?
Is this procedure up to date for the new OVH offers?
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| Re: [Tutorial] installing symfony for OVH [message #55208 is a reply to message #10307 ] |
Mon, 30 June 2008 22:05   |
gregoire_m Messages: 50 Registered: May 2008 Location: France |
Member |
|
|
Argl !! I've finally found the problem ! And as expected, it was a very small ******* bug... I've taken a look at the ovh doc, and the solution was in ! A permission problem on my root directory ! It was 755 instead of 705... (I don't remember having changed it, anyway... maybe !)
Thanks a lot lionel!
edit: it's the sync command who changes the root directory permissions...
[Updated on: Mon, 30 June 2008 22:19]
|
|
|
|
|
|