7

I am new to Drupal and am facing an issue where any theme that I try to install will fail with the following message:

Installing light_skeleton
An error has occurred.
Please continue to the error page

An AJAX HTTP error occurred.
HTTP Result Code: 403
Debugging information follows.
Path: /core/authorize.php/core/authorize.php?batch=1&id=4&op=do_nojs&op=do
StatusText: Forbidden
ResponseText: 
403 Forbidden
403 Forbidden
nginx/1.9.10

The root folder is owned by www-data:www-data and I have given the directory 775 permissions. I have also tried to give it a full access using chmod 777 but without success.

I have checked the logs of nginx and php but there are no errors displayed. The site itself, using the standard theme, works without any issues.

After getting the error, I get:

Notice: Undefined index: log in update_authorize_install_batch_finished() (line 291 of core/modules/update/update.authorize.inc).
Warning: Invalid argument supplied for foreach() in update_authorize_install_batch_finished() (line 291 of core/modules/update/update.authorize.inc).
Notice: Undefined index: log in update_authorize_install_batch_finished() (line 332 of core/modules/update/update.authorize.inc).
Notice: Undefined index: tasks in update_authorize_install_batch_finished() (line 333 of core/modules/update/update.authorize.inc).
Installation failed! See the log below for more information.
4
  • I get you are trying to upload a theme from the site.
    – apaderno
    Feb 21, 2016 at 8:31
  • Yes. Choosing the downloaded theme, and clicking install new theme, and selecting the file Feb 21, 2016 at 8:35
  • I have the same problem with modules. Check admin/reports/dblog and see if you get errors about ini_set() being disabled. Maybe that is the problem.
    – apaderno
    Feb 21, 2016 at 8:41
  • Didn't find any ref to ini_set() Feb 21, 2016 at 9:01

3 Answers 3

17

This is an nginx configuration issue and discussed intensely on this page Yet curiously no solid solution could be offered. Some guy on an other page proposed a solution. I applied that proposed solution and can confirm that in works!

To apply proposed solution go to your nginx configuration file under

/etc/nginx/sites-available/ directory on Ubuntu and add

rewrite ^/core/authorize.php/core/authorize.php(.*)$ /core/authorize.php$1;

just above the

location ~ \..*/.*\.php$ {
    return 403;
}

block. Location does matter!.. Restart your server:

sudo service nginx restart

and that's it. The problem solved!

3
  • 2
    That works! It's a shame that Drupal 8 seems needs that workaround with nginx! May 28, 2017 at 13:23
  • This is the only answer I have found that immediately resolves the issue for me. I am a bit disappointed that this is still an issue in Drupal 9.1.5. even though it appears to have been discussed, ad nauseum, on Drupal forums and elsewhere. Thanks! Mar 7, 2021 at 8:39
  • Worked for me.Thanks. Feb 12, 2022 at 13:38
2

Since you are getting a 403 response, it seems that Drupal is not giving you access for some reason. I haven't had any practical experience with this, but looking in the authorize.php, file I found this:

function authorize_access_allowed(Request $request) {
  $account = \Drupal::service('authentication')->authenticate($request);
  if ($account) {
    \Drupal::currentUser()->setAccount($account);
  }
  return Settings::get('allow_authorize_operations', TRUE) && \Drupal::currentUser()->hasPermission('administer software updates');
}

It seems that you could get an access denied response if:

  • You don't have administer software updates permission.
  • allow_authorize_operations is set to false. This would exist in your settings.php file AS $settings['allow_authorize_operations'] = FALSE;

Best guess is that it's the latter that might be your problem.

2
  • Tried both solutions but with no luck. I am the admin of the site as I have it on my own vps. Feb 21, 2016 at 9:02
  • Its good option to update settings.php rather than updaing ngnix conf, If it doesn't solve can try updating: $settings['update_free_access'] = FALSE;// Update it to TRUE Jun 9, 2020 at 13:02
-2

I have similar error, any solution?
update i just finally fixed it just add this: rewrite ^/core/authorize.php/core/authorize.php(.*)$ /core/authorize.php$1; to my server{} block of my nginx conf

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.