Re: file_exists() not working correctly?

From: Date: Mon, 25 Aug 2008 07:49:12 +0000
Subject: Re: file_exists() not working correctly?
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-278633@lists.php.net to get a copy of this message
That worked like a charm. Now, can you tell me why that exact same function works with a relative path on another server and with a "full path only" on this server? I am glad that it works, but would also like to understand why :o)
Could be different document roots for apache, different environment settings, lots of things. If you have a config variable for the base folder of your app, try to use that. If you don't, then work out the path relative to the file this function is in. $mydir = dirname(__FILE__); $path_to_folder = $mydir . '/../../images/....'; That way it's relative to the file the function is in and you don't have to change it each time you put it on a new server. -- Postgresql & php tutorials http://www.designmagick.com/

« previous php.general (#278633) next »