|
|
|
| Re: [Tutorial] installing symfony for OVH [message #58688 is a reply to message #58189 ] |
Thu, 14 August 2008 15:52   |
klhoste Messages: 10 Registered: August 2008 Location: Aix en Provence |
Junior Member |
|
|
| lionel wrote on Thu, 07 August 2008 15:48 | Hi,
Does you freeze your project ?
|
I freezed the project, and upload on OVH. I combined http://trac.symfony-project.org/wiki/InstallingSymfonyOnShar edHostNoSsh and http://trac.symfony-project.org/wiki/InstallingSymfonyOnOVH
Now, I get this structure :
/projects
/demo
/apps
/cache
/config
/data
/doc
/lib
/log
/plugin
/www
/css
/img
/js
/uploads
.htaccess
index.php
backend.php
In index.php I added :
<?php
/*require_once(dirname(__FILE__).'/../config/ProjectConfiguration.class.php');
$configuration = ProjectConfiguration::getApplicationConfiguration('frontend', 'prod', false);
sfContext::createInstance($configuration)->dispatch();*/
$vhost_root_dir = realpath(dirname(__FILE__).'/..');
$project_dir = $vhost_root_dir.'/projects/demo';
//define('SF_ROOT_DIR', realpath(dirname(__FILE__).'/..'));
define('SF_ROOT_DIR', $project_dir);
define('SF_APP', 'frontend');
define('SF_ENVIRONMENT', 'prod'); // for myapp_dev.php 'prod' should be 'dev'
define('SF_DEBUG', false); // for myapp_dev.php this should be true
// include path
set_include_path(
$vhost_root_dir.'/pear_libs'.PATH_SEPARATOR.
get_include_path()
);
unset($vhost_root_dir, $project_dir);
require_once(SF_ROOT_DIR.DIRECTORY_SEPARATOR.'apps'.DIRECTORY_SEPARATOR.SF_APP.DIRECTORY_SEPARATOR.'config'.DIRECTORY_SEPARATOR.'config.php');
sfContext::getInstance()->getController()->dispatch();
?>
And the .htaccess
SetEnv PHP_VER 5
SetEnv REGISTER_GLOBALS 0
SetEnv MAGIC_QUOTES 0
mod_gzip_on Off
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} !\.php
#RewriteCond %{REQUEST_URI} !\.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]
# hidden frontoffice controller
RewriteRule ^index\.php/(.*)$ /index.php [QSA,L]
# fo controllers
RewriteRule ^frontend\.php/(.*)$ /frontend.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"
I created a file config.php in apps/frontend/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,
));
?>
And now I get this error :
Fatal error: Class 'sfConfig' not found in /home.49/*****/projects/demo/apps/frontend/config/config.php on line 2
I think I have to define where to find the symfony libraries, what is the best solution ?
EDIT:
I forgot to tell you that during the freeze there was a Warning :
Warning: rename(C:\wamp\www\demo\data/symfony/web/sf,C:\wamp\www\demo\web/sf): No such file or directory in C:\wamp\bin\php\php5.2.6\PEAR\
symfony\task\sfFilesystem.class.php on line 189
Thanks
Kévin
[Updated on: Thu, 14 August 2008 16:14]
|
|
|
| Re: [Tutorial] installing symfony for OVH [message #59178 is a reply to message #10307 ] |
Thu, 21 August 2008 10:16   |
klhoste Messages: 10 Registered: August 2008 Location: Aix en Provence |
Junior Member |
|
|
Finally, I found a solution.
I simply copy all the directories from my symfony application to the root directory on OVH, except the /web directory which is put in the /www directory.
I modified some config files (databases.yml, propel.ini, .htaccess, ProjectConfiguration.class.php).
The .htaccess only contains :
The PEAR/symfony libraries are put in /lib/symfony
/config/ProjectConfiguration.class.php is modified :
<?php
require_once '../lib/symfony/autoload/sfCoreAutoload.class.php';
Then do a chmod 705 on directories in / and chmod 755 on directories in /www, and clear symfony cache directory.
Now, I've error 500 when I try to access the backend app, but the frontend works perfectly !
Precision : I didn't freeze the project, is it hazardous ?
Kévin
[Updated on: Thu, 21 August 2008 10:19]
|
|
|
|
|