Solved

is_dir is not working. Symlink problem??

Posted on 2011-09-08
4
742 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

SharePoint Admin?

Enable Your Employees To Focus On The Core With Intuitive Onscreen Guidance That is With You At The Moment of Need.

Question has a verified solution.

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

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…
Developers of all skill levels should learn to use current best practices when developing websites. However many developers, new and old, fall into the trap of using deprecated features because this is what so many tutorials and books tell them to u…
The viewer will learn how to dynamically set the form action using jQuery.
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 …

724 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