User 1 is unable to run /update.php, with the error: In order to run update.php you need to either have "Administer software updates" permission or have set $settings['update_free_access'] in your settings.php.

If I set $settings['update_free_access'] to true, I can run the update.

I get this even on a default installation [Drupal 9.4.8]. It looks like it is down to the Apache configuration:

DocumentRoot "/_site"

_site contains the following:

  • vendor
  • web
  • .htaccess
  • composer.json & .lock

/_site/.htaccess has the following:

RewriteEngine on
RewriteRule (.*) web/$1 [L]

In /_site/web/.htaccess I have the default drupal .htaccess with the following:

RewriteBase /web

With this set up, the site works mostly as expected at least for the public facing side fo things, There are some admin things such as batch operations that end up trying to go to /web on complatetion and failing, but the task runs to completion, just the redirect does not.

If I change my DocumentRoot to: "/_site/web/" and comment out RewriteBase /web I have access to /update.php and it works as expected.

I have set this up as the live hosting environment will not allow me to set DocumentRoot "/_site/web/" only DocumentRoot "/_site"

What do I need to change to allow the update to run without modifying $settings['update_free_access']

EDIT: additional config:

in settings.php, I have the following

$base_url = 'http://domain.com/';

if (isset($GLOBALS['request']) and '/web/index.php' === $GLOBALS['request']->server->get('SCRIPT_NAME')) {
 $GLOBALS['request']->server->set('SCRIPT_NAME', '/index.php');


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.