Jump to content

file_exists() not recognising file.


haku

Recommended Posts

I'm using Drupal, and I've been given a site to do a bit of work on. When uploading modules, Drupal automatically scans the folders in a directory for files with an extension of .info, and then lists those modules.

 

I've uploaded some new modules, but Drupal is not seeing them. I have tracked the problem down to the specific location where the problem exists. The line in question is this:

 

if (!file_exists($filename)) {
    return FALSE;
  }

 

However, the file definitely exists, so I'm at a bit of a loss.

 

As an example, I have the following directory structure:

 

sites/all/modules/acl

- acl.info

sites/all/modules/about_this_node

- about_this_node.info

 

This path returns true for file_exists():

sites/all/modules/acl/acl.info

 

But this file is returning false:

 

sites/all/modules/about_this_node/about_this_node.info

 

Even though the file definitely exists.

 

Does anyone have any idea why this may be happening?

Link to comment
Share on other sites

I'm sure this has already occurred to you to check, but...  Case sensitivity?

 

 

Aside from that...  Hrmmm...  File permissions shouldn't be it.

 

Is the path name too long?  (I don't know what the path limit is under linux, but it's 256 chars on Windows.)

 

I can't really think of anything else it could be.

Link to comment
Share on other sites

Thanks for the thoughts. Case sensitivity is not an issue, permissions have been checked and the file is readable (644), and the path name is quite short!

 

I'm at a loss here myself. I usually wouldn't post on an issue for something that looks to be as simple as this, but I've checked every last possible thing I can think of.

Link to comment
Share on other sites

I finally figured it out. The previous server maintainer had set php safe mode to on. When php safe mode is on, if the owner of the dir where the file stands differs from the php-owner, file_exists() returns false. I had to edit the httpd.include file for the server to turn off safe mode. Since safe mode is deprecated as of php 5.3.0, I turned it off.

 

What a headache that was! I hate taking over other people's work sometimes.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.