The Little Guy Posted December 19, 2011 Share Posted December 19, 2011 Why does this code: require_once "../../media/php/classes/Mysql.inc.php"; Work when I go to: http://mysite.com/API/v1/index.php But when I go to: http://mysite.com/index.php it doesn't work. The require is being called from another class, which I call from the two pages above. The class loads, but in the second link, I get failed to open stream: No such file or directory but the first one works fine. What would cause this? could this be an htaccess thing? htaccess: Options +FollowSymlinks RewriteEngine On RewriteBase / RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_FILENAME}.php -f RewriteRule ^(.+)$ /$1.php [L,QSA] Quote Link to comment https://forums.phpfreaks.com/topic/253446-no-such-file-or-directory/ Share on other sites More sharing options...
trq Posted December 19, 2011 Share Posted December 19, 2011 Why does this code: require_once "../../media/php/classes/Mysql.inc.php"; Work when I go to: http://mysite.com/API/v1/index.php But when I go to: http://mysite.com/index.php it doesn't work. Because ../../media/php/classes/Mysql.inc.php quote obviously doesn't exist when called from your sites root. Quote Link to comment https://forums.phpfreaks.com/topic/253446-no-such-file-or-directory/#findComment-1299104 Share on other sites More sharing options...
The Little Guy Posted December 19, 2011 Author Share Posted December 19, 2011 shouldn't it be calling it from the location of the file that has the require? I am including: "API/v1/class/Main.php" Within that file I am including: "../../media/php/classes/Mysql.inc.php" shouldn't it be up two directories from where "Main.php" is, and not the current running file? Quote Link to comment https://forums.phpfreaks.com/topic/253446-no-such-file-or-directory/#findComment-1299118 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.