TransWikia.com

Problems installing CiviCRM under Drupal 7 on Windows?

CiviCRM Asked by Stephen Palmstrom on January 14, 2021

I have just tried installing CiviCRM 5.30.1 using Drupal 7 under WIMP, i.e. Windows, IIS, MySQL and PHP 7.4, and was unable to do so, as I got a message telling me that sitesdefault was not writable. On investigation, it seems that the PHP function is_writable will always return false under Windows. This means that it seems you can’t install CiviCRM under Windows any more, as the IsCreatable function in sitesallmodulescivicrmsetupsrcSetupFileUtil.php relies on the is_writable function to test if the above folder is writable during the setup process. I got round it with the following code snippet.

public static function isCreateable($file) {
    if (file_exists($file)) {
      return is_writable($file);
    }

    $next = dirname($file);
    do {
      $current = $next;
        // Under Windows, it seems that folder are never writable      if (file_exists($current)) {
        if( is_writable($current)) {
          return true;
        } else {
          //Try to create a file
            $result = fopen("Test.tmp", "w");
            if ($result) {
            // Close the file.
            fclose($result);
            // Delete it.
            unlink("Test.tmp");
            return true;
            } else {
              return false;
            }
        }
      $next = dirname($current);
    } while ($current && $next && $current != $next);

    return FALSE;
  }

No doubt some of you CiviCRM experts will have a comment.

One Answer

In windows to change the folder permissions use attrib -r pathtositesdefault (can be a relative or absolute path).

Answered by Demerit on January 14, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP