razorsese Posted January 22, 2013 Share Posted January 22, 2013 Why when i'm doing something like in index.php: require("x/y.php") Y is found but when I do something like: index.php require("z.php") z.php require("x/y.php") Isn't working? Quote Link to comment https://forums.phpfreaks.com/topic/273502-php-require-question/ Share on other sites More sharing options...
requinix Posted January 22, 2013 Share Posted January 22, 2013 Have a careful read over the documentation for include() - require() and include() and the like all behave exactly the same when it comes to locating files. Files are included based on the file path given or, if none is given, the include_path specified. If the file isn't found in the include_path, include will finally check in the calling script's own directory and the current working directory before failing. The include construct will emit a warning if it cannot find a file; this is different behavior from require, which will emit a fatal error. If a path is defined — whether absolute (starting with a drive letter or \ on Windows, or / on Unix/Linux systems) or relative to the current directory (starting with . or ..) — the include_path will be ignored altogether. For example, if a filename begins with ../, the parser will look in the parent directory to find the requested file. Quote Link to comment https://forums.phpfreaks.com/topic/273502-php-require-question/#findComment-1407566 Share on other sites More sharing options...
premiso Posted January 22, 2013 Share Posted January 22, 2013 More than likely it will be a path issue. Do you have display errors turned on and your error_reporting set to E_ALL? If not that would be the first step I do is to try and get an error. Quote Link to comment https://forums.phpfreaks.com/topic/273502-php-require-question/#findComment-1407569 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.