Plesk file permissions - Apache/PHP conflicting with user accounts

11,401

Solution 1

What version of Plesk are you using? Perhaps you can change the site to use PHP-CGI for the site, so, any PHP scripts will run as the FTP user. Then, make sure all files in the httpdocs hierarchy are owned by the FTP user. Maybe this will help?

Solution 2

I had this problem with Drupal as well.

I solved it by disabling php's safe mode. This can be done through Plesk or manually by editing your httpd.include in the conf directory of the domain you are running drupal, followed by running apache2ctl graceful.

Share:
11,401

Related videos on Youtube

MrFidge
Author by

MrFidge

Updated on September 17, 2022

Comments

  • MrFidge
    MrFidge over 1 year

    I'm building a Drupal site which performs various automatic disk operations using the apache user (id=40).

    The problem is that the site was set up on a subdomain belonging to user ID 10001 (ie my main FTP account) so the filesystem belongs to that user ID.

    So I keep getting errors like this:

    warning: move_uploaded_file() [function.move-uploaded-file]: SAFE MODE Restriction in effect. 
    The script whose uid is 10001 is not allowed to access /var/www/vhosts/domain.com/httpdocs/sites/default/files/images/user owned by uid 48 in /var/www/vhosts/domain.com/httpdocs/includes/file.inc on line 579.
    

    I've tried changing the apache group in httpd.conf to apache:psacln, psacln being the default group for all web users but that's not helped.

    The situation now is:

    • ..../files/images/ = 777 and chown = ftplogin:psacln
    • ..../files/images/user = 775 and chown = apache:psacln
    • ..../files/tmp = 777 and chown = ftplogin:psacln

    So apparently uid 40 and 10001 both have permissions to write to any of the 3 directories involved, but still can't.

    Am i missing something here? Can anyone help?

    EDIT

    The solution was simply to set the domain / subdomain up to use apache in CGI-mode rather than straight out of the box mode.

    Thanks!

  • MrFidge
    MrFidge over 13 years
    Just checked in here after some months and you're right - this was the solution we used! Nice one :)
  • Imo
    Imo over 13 years
    Hi thanks for the feedback, glad to hear that it helped.