Tuesday, 06 January 2009

Ever faced the issue of having an other environment then your own? If not, get yourself the experience. You can learn from it! :)

But what a hell is it sometimes, tried setting up a drupal 6 project on a hosting account with plesk administration. Luckely with shell access..

First encounter with the plesk-aliens? I want private uploads (with funded reasons) so to give you a heads up on the structure created by the plesk panel.
The http directory (our webfolder)
/var/www/vhosts/drupal6project/httpdocs
The private file directory
/var/www/vhosts/drupal6project/private_files
The TMP directory (maybe obvious..)
/tmp

After confirming this in filesystem settings we get the following error :

  1. The directory /var/www/vhosts/drupal6project/private_files does not exist.

So we double check, triple, quatriple check. C'mon apache. It does exist! So let's investigate..

Possible solutions :

1) directory permissions (chmod)
2) directory owner (chown)
3) drupal issues? Doubt it...
4) php configuration
5) Apache configuration

Since all of these were quite hard to manage in plesk system I dove in to the dark bash...
Look what I found!

/var/www/vhosts/drupal6project/conf

  1. <IfModule mod_php4.c>
  2. php_admin_flag engine on
  3. php_admin_flag safe_mode on
  4. php_admin_value open_basedir "/var/www/vhosts/drupal6project/httpdocs:/tmp"
  5. </IfModule>
  6. <IfModule mod_php5.c>
  7. php_admin_flag engine on
  8. php_admin_flag safe_mode on
  9. php_admin_value open_basedir "/var/www/vhosts/drupal6project/httpdocs:/tmp"
  10. </IfModule>

So just add your folder to the open_basedir directory and it can be found by the webapplication (in our case drupal)

example :

  1. php_admin_value open_basedir
  2. "/var/www/vhosts/drupal6project/httpdocs:/tmp:/var/www/vhosts/drupal6project/private_files"

Hmm, after some testing it was still not exactly how we wanted it. Next error? Bring it on!

  1. mkdir() [<a href='function.mkdir'>function.mkdir</a>]: SAFE MODE Restriction in effect.
  2. The script whose uid is 0 is not allowed to access /var/www/vhosts/drupal6project/private_files/59
  3. owned by uid 33 in ...

Since our access permissions are optimal in the server itself and safe_mode is quite obsolete (it will even disappear in PHP6) you can just turn it off.

Update 1 (thanks to sun):
Found an easier way !
Add a vhost.conf file with following data in
/var/www/vhosts/drupal6project/conf :

  1. <Directory /var/www/vhosts/drupal6project/httpdocs/>
  2. php_admin_flag safe_mode off
  3. php_admin_value open_basedir
  4. "/var/www/vhosts/drupal6project/httpdocs:/tmp:/var/www/vhosts/drupal6project/private_files:
  5. </Directory>

Execute /usr/local/psa/admin/bin/websrvmng -a to reconfigure plesk.
restart apache and check your website working with plesk and private files

Happy plesking in drupal!

Written byAdmin

Still a secret, more to come soon.

Post new comment

The content of this field is kept private and will not be shown publicly.
  • Allowed HTML tags: <a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd> <img> <h4> <br>
  • You can enable syntax highlighting of source code with the following tags: <code>, <blockcode>, <c>, <cpp>, <drupal5>, <drupal6>, <java>, <javascript>, <php>, <python>, <ruby>. The supported tag styles are: <foo>, [foo].
  • Web page addresses and e-mail addresses turn into links automatically.
  • Lines and paragraphs break automatically.

More information about formatting options

By submitting this form, you accept the Mollom privacy policy.