takn25 Posted March 21, 2011 Share Posted March 21, 2011 Hi, I am trying to upload my PHP file in a directory on the sub domain called "pro" the error I am getting is I have used <?php include ("/pro/error_function.php"); ?> Warning: include(/pro/error_function.php) [function.include]: failed to open stream: No such file or directory in and Warning: include() [function.include]: Failed opening '/pro/error_function.php' for inclusion (include_path='.:/usr/lib/php:/usr/local/lib/php') could some one help me what is the problem? Quote Link to comment https://forums.phpfreaks.com/topic/231231-include-error/ Share on other sites More sharing options...
takn25 Posted March 21, 2011 Author Share Posted March 21, 2011 Ok I figured it out but still would appreciate your suggestions. Quote Link to comment https://forums.phpfreaks.com/topic/231231-include-error/#findComment-1190112 Share on other sites More sharing options...
PFMaBiSmAd Posted March 21, 2011 Share Posted March 21, 2011 A leading slash / on a file path refers to the root of the current hard disk. You would either use an absolute file path ($_SERVER['DOCUMENT_ROOT'] will get the base path to your document root folder) or you would use a file path relative to the current script (a file path starting with a ./ or a ../) or you would let php search the include_path setting to find the file (when neither an absolute or relative file path is given.) All of this information can be found in the php.net document for the include() statement. Quote Link to comment https://forums.phpfreaks.com/topic/231231-include-error/#findComment-1190114 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.