Link to home
Start Free TrialLog in
Avatar of innercproductions
innercproductions

asked on

PHP - file_exists problem

I'm having trouble with this PHP code.
The file DOES exist, but it's giving me the other result.

if(!file_exists($file))
            {
                        echo "Does not exist";
            }
            else
            {
                        echo "Yes! Exists!";
            }


I need help. Why is it working backwards?
Are there any other options?
Avatar of Terry Woods
Terry Woods
Flag of New Zealand image

The web server needs read access to the file and the folder that contains it I believe. Try checking that.
ASKER CERTIFIED SOLUTION
Avatar of Terry Woods
Terry Woods
Flag of New Zealand image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
please post an example for $file
Avatar of innercproductions
innercproductions

ASKER

I think it's working now. But I'm not sure what I changed.

Question:  what does the PHP safe mode do? In simple terms... short description. AND... is it really needed?
Note in the PHP manual (http://jp.php.net/manual/en/features.safe-mode.php):
"Safe Mode was removed in PHP 6.0.0"

Quote from: http://www.webhostgear.com/319.html

Safe mode is an easy way to lock down the security and functions you can use. PHP.net explains php safe_mode as, "The PHP safe mode is an attempt to solve the shared-server security problem. It is architecturally incorrect to try to solve this problem at the PHP level, but since the alternatives at the web server and OS levels aren't very realistic, many people, especially ISP's, use safe mode for now."

I highly recommend you enable safe_mode on production servers, especially in shared environments. This will stop exec functions and others that can easily prevent a security breach.

SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Thanks for the info.
Anyone want to suggest how to divide/give points?
Do you think your solution had anything to do with taking PHP out of safe mode? If so, then please pick my solution as the primary one (250) and offer assists (125 ea) to Terry and hoffman. If not, then just divide the points evenly between Terry and hoffman, because you asked a new question which they answered and I did not participate in.

That's my advice anyway. If you're primary question was never answered and your secondary was, then it seems fair to divide the points between those who answered the secondary question.
Since none of you hit the nail on the head (probably because I didn't know exactly what to ask)... but all of you did help me with info and somehow probably led me to the solution... I will divide points evenly.

I turned SafeMode back on and restarted the webserver... nothing changed. It still works.
So I don't think that was it MasonWolf. But i did consider your suggestion. Thanks.