Jump to content

"failed to open stream: No such file or directory in" error


davykiash

Recommended Posts

Hi

 

Am a newbie using PHP Version 5.2.6.

 

I am consitently getting this error

 

Warning: include(/layout.php) [function.include]: failed to open stream: No such file or directory in E:\Tata\PHPSites\Membership\index.php on line 3

 

Warning: include() [function.include]: Failed opening '/layout.php' for inclusion (include_path='.;C:\php5\pear') in E:\Tata\PHPSites\Membership\index.php on line 3

 

Fatal error: Call to undefined function myheader() in E:\Tata\PHPSites\Membership\index.php on line 5

 

the files are existing in there respective directories.

 

What am i missing?

 

Thanks in Advance

Link to comment
Share on other sites

your include path is incorrect check if it reffers to the right folder

include("layout.php");

 

This is the source file from which i am browsing

 

<?php

// include the layout file

include $_SERVER['DOCUMENT_ROOT'].'/layout.php';

// Use the myheader function from layout.php

myheader("Welcome to My Website!");

// Include the welcome html page.

include $_SERVER['DOCUMENT_ROOT'].'/html/index_page.html';

// Use the footer function from layout.php

footer();

?>

Link to comment
Share on other sites

Either $_SERVER['DOCUMENT_ROOT'] is not being set on your server or you have some code prior to what you posted that is overwriting it or a statement in a .htaccess file that is setting it to an empty value.

 

Is the code you just posted to echo $_SERVER['DOCUMENT_ROOT'] the only code in the file?

Link to comment
Share on other sites

Either $_SERVER['DOCUMENT_ROOT'] is not being set on your server or you have some code prior to what you posted that is overwriting it or a statement in a .htaccess file that is setting it to an empty value.

 

Is the code you just posted to echo $_SERVER['DOCUMENT_ROOT'] the only code in the file?

 

That is the only code in my script

 

<?php

echo($_SERVER['DOCUMENT_ROOT'])

?>

 

Actually i ran up a search and i found it could be because i use IIS and ths is an apache thing.

Could that be?

Link to comment
Share on other sites

Actual code? And what does echoing $_SERVER['DOCUMENT_ROOT'] show? You probably have a missing \ or too many of them \\

 

the code is that simple.only three lines.

If u follow this topic u will realise i was zeroing down on a problem.

 

<?php

echo($_SERVER['DOCUMENT_ROOT']);

?>

 

And i use IIS.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.