9

I've recently set up a subdomain of mine on a VPS, installed Drupal 7.56, and managed to download the civicrm module but when I go to http://mysite.net/drupal-7.56/sites/all/modules/civicrm/install/index.php

It give me this:

You don't have permission to access this page 

I was logged in as the admin before I tried the install. Not sure if this is file permissions or what.

PHP 7.0 Drupal 7.56 CiviCRM 4.7.28

Thanks in advance, John

6
  • can you clarify what you did in terms of setting up a DB for civi?
    – petednz - fuzion
    Commented Dec 11, 2017 at 4:29
  • I set up both a drupal db (jwf_drupaldb) and a db that I might choose to use for the civi install (jwf_cividb). The user jwf has full access to both of these. Of course, the drupal install populated all the drupal tables into jwf_drupaldb. At that point I downloaded the civi module but when I went to kick off the installer, user_access('administer site configuration') evaluated false and gave the error above. Commented Dec 11, 2017 at 16:04
  • Still really could use some advice. I'll be glad to provide other details - just let me know. Commented Dec 14, 2017 at 15:51
  • I have same issue with same drupal and civicrm configuration. Thank you. Commented Dec 19, 2017 at 15:06
  • Same problem as the original poster: stock install of Drupal 7.5.x and CiviCRM 5.4, unable to access the install page. Used the comment-out security check to bypass. Later discovered that I also had permissions problems at /sites/default: they were set to 555, which seems like an obvious error. Implies that there's likely a permissions-level fix somewhere. Commented Aug 15, 2018 at 9:14

7 Answers 7

11

I faced this problem too and tried a lot of things to make it works, but failed.

Finally, I opened the file "index.php" in "http://(mysite)/sites/all/modules/civicrm/install/index.php". I put the comments in line number 265th through 274th like this.

/*
  // Check that user is logged in and has administrative permissions
  // This is necessary because the script exposes the database settings in the form and these could be viewed by unauthorised users
  if ((!function_exists('user_access')) || (!user_access('administer site configuration'))) {
    $errorTitle = ts("You don't have permission to access this page");
    $errorMsg = ts("The installer can only be run by a user with the permission to administer site configuration.");
    errorDisplayPage($errorTitle, $errorMsg);
    exit();
  }
*/

Yeah. IT WORKS!!!.

Who use this way like me, DON'T for get to remove the comments after installation is completed.

5
  • Don't forget to remove the comment after installation is completed.
    – pnbps
    Commented Dec 24, 2017 at 3:24
  • 4
    It "works" because you're disabling security checks. This seems like a Bad Idea to recommend to general users.
    – choster
    Commented Dec 28, 2017 at 20:00
  • Yes, this will work, but it would be good to understand why you are getting the error in the first place. Was Drupal installed and functioning correctly? Did you log in with a user that has 'administer site configuration' permissions? Commented Dec 31, 2017 at 16:07
  • Why we are getting this error even though logged in as admin user? Commented Feb 28, 2018 at 2:11
  • Thanks! Your solution works! Additional comments had all been ruled out and no explanation. Maybe this is a bug??
    – user21507
    Commented Aug 1, 2018 at 16:27
7

The error is due to an incorrect base url of your Drupal installation.

Go to site/default and edit the file settings.php

Search for $base_url, and set it to the correct url of your site.

e.g. http://localhost/~YOUR-USER-NAME/SUBFOLDER-OF-YOUR-SITE

In my case, line 315 of settings.php looks like this:

$base_url = 'http://localhost/~alain/civitest';  // NO trailing slash!
1
  • 1
    This worked for me!
    – Keith Webb
    Commented Jan 20, 2019 at 1:41
2

on investigate the root cause of problem to identify the reason for condition "!user_access('administer site configuration')" getting true; it is, while checking for the user roles in "user.module", the global variable $user is assigned with values corresponding to anonymous user and that make the condition to true and returns the error message and exits.

May be we need to investigate further in "session.inc" to clearly identify root cause of the problem to find a straight forward solution for this.

1
  • I faced the same problem. The CiviCRM-installation were impossible for the last two versions (4.7.28 and 4.7.29). The drupal-installation seems to be allright and the user I am logged in with is the first and only drupal-user with full admin-permissions...
    – Thomas
    Commented Jan 16, 2018 at 15:58
2

I think this message is displayed because of some code that I added during the UK CiviCRM Sprint. This code automatically fills in the database details in the installer.

As this is disclosing sensitive information it checks to see if the user has sufficient permissions to access the installer page. It will fail if your user doesn't have permission to 'administer site configuration'. Please check that your user has the correct permissions.

The check will also fail if Drupal isn't bootstrapped correctly. Is Drupal installed and functioning correctly?

2
  • I have the same problem on my local machine with a fresh install of Drupal. If I then try to install CiviCRM it will give a false for the administer site configuration even though I am logged in as administrator. Commented Jan 23, 2018 at 10:58
  • I think it is or because Drupal is not standard bootstrapped at this url (the civi install file is bootstrapping Drupal at line 1515 but maybe this is too late because the check is around line 280 or because there is a line at 1521 // Force the current user to anonymous. $original_user = $GLOBALS['user']; $GLOBALS['user'] = drupal_anonymous_user(); Commented Jan 18, 2019 at 23:13
2

Windows installation (XAMPP) with Drupal 7.59 and civicrm 4.7.31
I tried first the trick of Muhammad Sadiq:
- it worked to avoid the error and to initiate the install
- but the permissions for the civicrm module were all blank (index.php?q=admin/people/permissions)
Second I tried the trick of pnbps with commenting line numbers 265th through 274th of "http://(mysite)/sites/all/modules/civicrm/install/index.php"
- it worked to avoid the error and to initiate the install
- this time the default permissions for the civicrm module are ok

1

I have no idea how to solve the issue but I think commenting out the security check is not a great idea :-) As mentioned I encounter the same issue on a clean install of Drupal 7.56 on my local machine without creating any new user. When I then install CiviCRM 4.7.29 I get the permission error. @WilliamMortada: happy to provide details and test if you are happy to have a look.

My own local workaround is to install 4.7.27 and then immediately upgrade!

Checking with Tim here at the sprint: it looks like the test for the permission does not work if you install Drupal in subfolders? We are not sure if that is the issue but it might be worth a quick look.

-1
  • i got the point, i also faced the same problem for 2 days and at last i figure out that the user created during installation looks like not given the administrator rights and this might be a bug may be, anyways i did by changing following permissions.
  • Goto People->permissions
  • Under system heading there is 'Administer site configuration' permission.
  • Give this permission to Annonymous User and Authenticated User.
  • save changes and you are done.

Note: Revoke permission from both users after installation.

Your Answer

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

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