CiviCRM Community Forums (archive)

*

News:

Have a question about CiviCRM?
Get it answered quickly at the new
CiviCRM Stack Exchange Q+A site

This forum was archived on 25 November 2017. Learn more.
How to get involved.
What to do if you think you've found a bug.



  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Support »
  • Installing CiviCRM »
  • Drupal Installations (Moderator: Piotr Szotkowski) »
  • mkdir is 'Unable to access' in Drupal 5.2 and CiviCRM 1.8
Pages: [1]

Author Topic: mkdir is 'Unable to access' in Drupal 5.2 and CiviCRM 1.8  (Read 2745 times)

rahul_mojo

  • Guest
mkdir is 'Unable to access' in Drupal 5.2 and CiviCRM 1.8
October 30, 2007, 08:27:10 am
Hi all,

I was hoping somebody could help me out with some quite strange behaviour I have come across whilst trying to install CiviCRM 1.8.11536 for PHP4 over Drupal 5.2.

I have installed Drupal without any issues that I am aware of. After CiviCRM is enabled as a Drupal module, I receive the following errors:

Code: [Select]
    * warning: mkdir() [function.mkdir]: Unable to access /nfsn/content/mojotest/public/files/civicrm/custom/ in /nfsn/content/mojotest/public/sites/all/modules/civicrm/CRM/Utils/File.php on line 118.
    * warning: mkdir() [function.mkdir]: Unable to access /nfsn/content/mojotest/public/files/civicrm/templates_c/en_US/ in /nfsn/content/mojotest/public/sites/all/modules/civicrm/CRM/Utils/File.php on line 118.
    * warning: mkdir() [function.mkdir]: Unable to access /nfsn/content/mojotest/public/files/civicrm/templates_c/en_US/ in /nfsn/content/mojotest/public/sites/all/modules/civicrm/CRM/Utils/File.php on line 118.

It appears that CiviCRM is having difficulty mkdir'ing the directories it requires under /files.

/files contains, amongst other things:
drwxrwxrwx  3 me   web   512 Oct 30 14:31 civicrm

/civicrm contains, as recommended by the CiviCRM installation guide (http://wiki.civicrm.org/confluence/display/CRMDOC/Install+CiviCRM+1.8+for+Drupal), the following three directories:
drwxrwxrwx  2 me  web  512 Oct 30 15:08 crm_docs
drwxrwxrwx  2 me  web  512 Oct 30 15:09 templates_c
drwxrwxrwx  2 me  web  512 Oct 30 15:08 upload

As you can see, I've made the group of all these directories web, and I've also chmod'ed them to 777 for good measure.


FYI, mkdir is being called from this function in civicrm/CRM/Utils/File.php:


Code: [Select]
    /**
     * create a directory given a path name, creates parent directories
     * if needed
     *
     * @param string $path  the path name
     *
     * @return void
     * @access public
     * @static
     */
    function createDir( $path ) {
        if ( is_dir( $path ) || empty( $path ) ) {
            return;
        }

        CRM_Utils_File::createDir( dirname( $path ) );
        mkdir( $path, 0777 );
    }


It appears that CiviCRM is having difficulty making the directories it needs to run. I can confirm this by manually creating under /files/civicrm the directories /custom and /templates_c/en_US -- this removes the errors, but not their underlying cause. A bit of CiviCRM usage brings back the same issue with mkdir.


Thanks for taking the time to read down to here. Any ideas?

Best,
Rahul

Donald Lobo

  • Administrator
  • I’m (like) Lobo ;)
  • *****
  • Posts: 15963
  • Karma: 470
    • CiviCRM site
  • CiviCRM version: 4.2+
  • CMS version: Drupal 7, Joomla 2.5+
  • MySQL version: 5.5.x
  • PHP version: 5.4.x
Re: mkdir is 'Unable to access' in Drupal 5.2 and CiviCRM 1.8
October 30, 2007, 11:32:47 am

1. if this is a new install, you should install 1.9 :) will save you an upgrade later

2. is php safemode or some other settings enabled on your php version. the directory permissions look right, so the error is strange. basically php is reporting that the mkdir call is failing. (in 1.9 we abort immediately to make it easier for people to isolate and fix)

lobo
A new CiviCRM Q&A resource needs YOUR help to get started. Visit our StackExchange proposed site, sign up and vote on 5 questions

rahul_mojo

  • Guest
Re: mkdir is 'Unable to access' in Drupal 5.2 and CiviCRM 1.8
October 30, 2007, 01:00:35 pm
Hi lobo,

Thanks for your reply.

My host is nearlyfreespeech.net (NFSN).

1. NFSN use PHP 4.4.7 with safe_mode: http://example.nfshost.com/phpinfo.php. I understand that CiviCRM 1.9 requires PHP 5+, so I can only use 1.8 or earlier. I chose the latest revision of version 1.8.

2. Understandably, NFSN's position on safe_mode is non-negotiable (from their FAQ):

Quote
Can PHP safe_mode be turned off for my site?

No. In a shared hosting environment such as we offer, keeping everyone's web site safe and secure is of vital importance. We have carefully constructed an environment where your site and its files can be as secure as possible, and PHP's safe_mode is currently one of the many essential components of that environment. Therefore we apologize, but we cannot allow it to be disabled.

We are looking into ways to make PHP available without safe_mode because a very few popular applications won't work in this environment. However, that effort has not been assigned a completion date.

This question almost always comes up in conjunction with one application, Gallery. Gallery's developers have been less than receptive to the idea that their software should be updated to work with safe_mode, so unless we find a way to work around it, it is unlikely this application will ever work on our system.

If your interest in disabling PHP's safe_mode stems from a desire to run Gallery, we recommended that you consider Coppermine Photo Gallery instead. It offers very similar features, but does not have Gallery's restrictions and works very well on our system.

However, having looked through the trouble other people have had with safe_mode in previous versions of CiviCRM, I thought that these issues had since been found and fixed. Am I mistaken here or is there another reason for the error?

Thanks,
Rahul

Donald Lobo

  • Administrator
  • I’m (like) Lobo ;)
  • *****
  • Posts: 15963
  • Karma: 470
    • CiviCRM site
  • CiviCRM version: 4.2+
  • CMS version: Drupal 7, Joomla 2.5+
  • MySQL version: 5.5.x
  • PHP version: 5.4.x
Re: mkdir is 'Unable to access' in Drupal 5.2 and CiviCRM 1.8
October 30, 2007, 04:59:41 pm

hey rahul:

sorry, we dont know a lot about safe_mode so i just guessed it might be some setting like that. You might want to check what settings you need to enable php/apache to write to that directory. I suspect it is just a safe_mode path or something similar

; open_basedir, if set, limits all file operations to the defined directory
; and below.  This directive makes most sense if used in a per-directory
; or per-virtualhost web server configuration file. This directive is
; *NOT* affected by whether Safe Mode is turned On or Off.
;open_basedir =

alternatively NFSN might have a better idea of why the error is being thrown. smarty create multiple cache directories under the base directory, so u need directory creation to work

You might want to replace the mkdir in CRM/Utils/File.php with this one:

        if ( mkdir( $path, 0777 ) == false ) {
            echo "Error: Could not create directory: $path. <p>";
            exit( );
        }

so u abort immediately. might make debugging a wee bit easier and faster

lobo
 


lobo
A new CiviCRM Q&A resource needs YOUR help to get started. Visit our StackExchange proposed site, sign up and vote on 5 questions

Pages: [1]
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Support »
  • Installing CiviCRM »
  • Drupal Installations (Moderator: Piotr Szotkowski) »
  • mkdir is 'Unable to access' in Drupal 5.2 and CiviCRM 1.8

This forum was archived on 2017-11-26.