Solved

is_dir is not working. Symlink problem??

Posted on 2011-09-08
4
716 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 500 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

Free Trending Threat Insights Every Day

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

Consider the following scenario: You are working on a website and make something great - something that lets the server work with information submitted by your users. This could be anything, from a simple guestbook to a e-Money solution. But what…
I imagine that there are some, like me, who require a way of getting currency exchange rates for implementation in web project from time to time, so I thought I would share a solution that I have developed for this purpose. It turns out that Yaho…
The viewer will learn how to count occurrences of each item in an array.
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…

707 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

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now