Drupal upgrade failed: PHP Warning: rename(../settings.php): Permission denied

Created:

2016-11-16 13:15:41 UTC

Modified:

2017-04-24 11:41:25 UTC

0

Was this article helpful?


Have more questions?

Submit a request

Drupal upgrade failed: PHP Warning: rename(../settings.php): Permission denied

Applicable to:

  • Plesk 12.0 for Linux

Symptoms

Auto update for Drupal installation failed with permission errors.

In /var/log/plesk/panel.log the following errors can be found:

[2015-03-21 02:25:12] ERR [panel] Script execution failed: PHP Warning:  rename(/var/www/vhosts/domain.tld/httpdocs//sites/default/settings.php,/var/www/vhosts/domain.tld/httpdocs//sites/default/settings.php1426904706): Permission denied in /usr/local/psa/var/apspackages/apscatalog8uLksl.zip326cba67-e169-42/cache/scripts/app-util.php on line 61
PHP Warning: include(/var/www/vhosts/domain.tld/httpdocs//update.php): failed to open stream: No such file or directory in /usr/local/psa/var/apspackages/apscatalog8uLksl.zip326cba67-e169-42/cache/scripts/upgrade-app.php on line 83
PHP Warning: include(): Failed opening '/var/www/vhosts/domain.tld/httpdocs//update.php' for inclusion (include_path='.') in /usr/local/psa/var/apspackages/apscatalog8uLksl.zip326cba67-e169-42/cache/scripts/upgrade-app.php on line 83
PHP Notice: Undefined variable: _SESSION in /usr/local/psa/var/apspackages/apscatalog8uLksl.zip326cba67-e169-42/cache/scripts/upgrade-app.php on line 98

Cause

Cause of the issue is invalid permissions to the sites/default directory. The user performing package upgrade has no write permissions to this directory. As a result, the call "sappmng --extract-application ..." fails with the following error:

Filesystem error: boost::filesystem::remove: Permission denied: "/var/www/vhosts/domain.tld/httpdocs/sites/default/default.settings.php"

and with exit code 1.

Mentioned above permissions (555) are set by Drupal. Though at the moment of installation (for the old version) Plesk sets permissions 755, but if you open Drupal->Reports->Status report , then Drupal becomes aware of it and reverts permissions to the state it considers correct.

This behavior is considered as software issue with ID APSI-1 it will be fixed in one of the next Plesk updates.

Resolution

  1. Restore domain from a backup
  2. Change permissions as shown on example:

    [root@ ~]# chmod 755 /var/www/vhosts/subscription.tld/httpdocs/sites/default
    [root@ ~]# chmod 755 /var/www/vhosts/subscription.tld/httpdocs/sites/default/*
  3. Upgrade Drupal again.

If you do not have a backup please contact Odin Technical Support.

Have more questions? Submit a request
Please sign in to leave a comment.