Getting Symfony2 to run under PLESK

I had a bit of trouble getting Symfony 2 setup properly under PLESK (10.2.0).

I first created a subdomain using the “web” directory of Symfony 2 as document root for the vhost.

However, I seemed to could not get rid of the errors calling config.php telling me, that app/cache and app/logs were not writeable by the server. After searching the web top to bottom and having a look at the output of php_info() I identified the culprit. PLESK sets open_basedir (the topmost directory that is accessible by your web server) to the document root:

open_basedir var/www/vhosts/<YOURDOMAIN>/ <SUBDOMAINHTTPDOCS>/Symfony/web/:/tmp/

To remedy this place a file called “vhost.conf” under /var/www/vhost/<YOURDOMAIN>/subdomains/ <SUBDOMAIN>/conf containing directives overriding PLESK’s settings, e.g.:

<Directory /var/www/vhosts/YOURDOMAIN/DOCUMENTROOT/Symfony/web>

<IfModule mod_php4.c>
php_admin_flag engine on
php_admin_flag safe_mode off
php_admin_value open_basedir /var/www/vhosts/YOURDOMAIN/SUBDOMAINHTTPDOCS/:/tmp/:
</IfModule>

<IfModule mod_php5.c>
php_admin_flag engine on
php_admin_flag safe_mode off
php_admin_value open_basedir /var/www/vhosts/YOURDOMAIN/SUBDOMAINHTTPDOCS/:/tmp/:
</IfModule>

</Directory>

Now to get the settings into the system run as root:

/usr/local/psa/admin/bin/httpdmng --reconfigure-all

Then restart Apache:

apache2ctl restart

Share
dürftigausreichendordentlichgutfamos (1 votes, average: 4.00 out of 5)
Loading...
Tags: , , , , ,

Comments