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

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();

?>

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?

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?

There is a doc_root = setting in php.ini that should be set under IIS to be to your IIS root folder, typically c:\Inetpub\wwwroot

 

i have changed the setting.

The error has change from displaying nothing to "The page cannot be found"

 

 

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.

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.