Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

is_dir is not working. Symlink problem??

Posted on 2011-09-08
4
Medium Priority
?
786 Views
Last Modified: 2012-05-12
in my code i have

$usersdir = /home/events/html/userdirs

    if ( !file_exists($usersdir) || is_dir($usersdir)){
        throw new Exception('Internal Error. '.$usersdir.' userdir does not exist');
    }

i get the error
PHP Fatal Error:  Internal Error. /home/events/html/userdirs userdir does not exist'

this does not make sense.
the only thing i can think of is that  /home/events is a symlink.
apache has followsymlinks and all that seems to work.

i found somewhere that is may be php safemode , but from my php.ini i have
safe_mode = Off

Thanks for any help

0
Comment
Question by:paries
4 Comments
 
LVL 82

Accepted Solution

by:
hielo earned 2000 total points
ID: 36507982
>>$usersdir = /home/events/html/userdirs
needs quoting:

$usersdir = '/home/events/html/userdirs';

try a ! in front of is_dir() as well:

 if ( !file_exists($usersdir) || !is_dir($usersdir)){
     throw new Exception('Internal Error. '.$usersdir.' userdir does not exist');
    }
0
 
LVL 4

Expert Comment

by:David Linker
ID: 36508126
Could this be a permissions problem - the account under which apache is running doesn't have rights to the directory.
0
 
LVL 7

Expert Comment

by:Vimal DM
ID: 36508128
Hai,

If your checking for the directory,plz do you only for the directory check alone
0
 

Expert Comment

by:saurabhgoyalwebexpert
ID: 36508553
As per your code the error (Internal Error. /home/events/html/userdirs userdir does not exist) is shown When either userdirs does not exists or it is a directory . And I think userdirs is a directory that why this error message is shown . So,Please cross check your code with ur  logic.

Regards
Saurabh Goyal
LAMP Expert
http://sggoyal.blogspot.com
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Things That Drive Us Nuts Have you noticed the use of the reCaptcha feature at EE and other web sites?  It wants you to read and retype something that looks like this. Insanity!  It's not EE's fault - that's just the way reCaptcha works.  But it i…
3 proven steps to speed up Magento powered sites. The article focus is on optimizing time to first byte (TTFB), full page caching and configuring server for optimal performance.
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …
Suggested Courses

885 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question