Page 1 of 1

warning: failed to open stream error

Posted: Thu Mar 24, 2005 4:23 pm
by bruceg
can anyone assist me in possibilities to why my includes receive this error:

Warning: main(/web_calendar/connect.php): failed to open stream: No such file or directory in c:\inetpub\wwwroot\web_ calendar\admin.php on line 45

the file is called admin.php and resides in a folder called web_calendar which is at the root level on my site.

the include is called as such :

<?php include("/web_calendar/connect.php"); ?>

I'm using IIS instead of apache

thanks in advance,

Bruce Gilbert
Webmaster
DPS

post the code

Posted: Thu Mar 24, 2005 4:25 pm
by method_man
post the code

matt

Posted: Thu Mar 24, 2005 4:34 pm
by bruceg
well basicly I get an error everytime I call a file with include.

Here is code from a sample file with different ways to call the include with PHP and they all give me errors.

the includes are located within a file called SSI which is at the root level.

Code: Select all

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
        "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
	<title>include test</title>
</head>
<body>

<!--quick test by Chris Ogden for DPS  -->

This file is located in: "<b><?php echo dirname(__FILE__) ;  ?></b>"

<p><p>
absolute path (should always work): "<?php include ' c:\inetpub\wwwroot\SSI\footer.htm'; ?>"

<p><p>
separator: "<?php echo PATH_SEPARATOR; ?>"

<p><p>
include_path before: <?php echo get_include_path(); ?>

<?php set_include_path(get_include_path() .PATH_SEPARATOR.' c:\inetpub\wwwroot\SSI'); ?>

<br>
include_path after adding SSI: <?php echo get_include_path(); ?>


<p><p>
just the filename should now work: "<?php include('footer.htm'); ?>"




<p><p>
no lead slash (should only work if calling file is "above" the SSI directory):  "<?php include("SSI/footer.htm"); ?>"

<p><p>
dots (should only work if in a subdirectory at the same level as SSI): "<?php include("../SSI/footer.htm"); ?>"



</body>
</html>

thx,

-Bruce


feyd | Please review how to post code using

Code: Select all

and

Code: Select all

tags. Read:  [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url][/color]

Posted: Thu Mar 24, 2005 4:48 pm
by feyd

Code: Select all

include('/foo/bar.php');
is a literal path. It goes to the file system root of the server file area. So in your case including '/web_calendar/connect.php' means c:/web_calendar/connect.php