Solved

is_dir is not working. Symlink problem??

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

MS Dynamics Made Instantly Simpler

Make Your Microsoft Dynamics Investment Count  & Drastically Decrease Training Time by Providing Intuitive Step-By-Step WalkThru Tutorials.

Question has a verified solution.

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

Suggested Solutions

Part of the Global Positioning System A geocode (https://developers.google.com/maps/documentation/geocoding/) is the major subset of a GPS coordinate (http://en.wikipedia.org/wiki/Global_Positioning_System), the other parts being the altitude and t…
Since pre-biblical times, humans have sought ways to keep secrets, and share the secrets selectively.  This article explores the ways PHP can be used to hide and encrypt information.
Learn how to match and substitute tagged data using PHP regular expressions. Demonstrated on Windows 7, but also applies to other operating systems. Demonstrated technique applies to PHP (all versions) and Firefox, but very similar techniques will w…
The viewer will learn how to count occurrences of each item in an array.

726 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