Page 1 of 1

Include Question

Posted: Mon May 26, 2003 6:51 pm
by ThinkGeekness
I am trying to use the Include code and it works if I have:

Code: Select all

<?php include("header.php") ?>
and header.php in the same directory

It doesnt work if I have:

Code: Select all

<?php include("./header.php") ?>


Or:

Code: Select all

<?php include("http://www.mysite.com/header.php") ?>


I get one of the following error messages:
Warning: Failed opening './header.php' for inclusion (include_path='.:/usr/local/lib/php') in /usr/local/apache_1.3.27/htdocs/mysite/subpage/index.php on line 10
or:
Warning: Failed opening 'http://www.mysite.com/header.php' for inclusion (include_path='.:/usr/local/lib/php') in /usr/local/apache_1.3.27/htdocs/mysite/subpage/index.php on line 10
What I basically want to do is to have it point to header.php in the root directory. What am I doing wrong?

Thanks

Posted: Mon May 26, 2003 8:23 pm
by phice
If the php file you're making is in the same directory as "header.php", then you only need to do: include("header.php");

If it isn't, then you should find the full directory to your header.php (example: /home/your_site/htdocs/) and include it like: include("/home/your_site/htdocs/header.php");

Posted: Mon May 26, 2003 9:11 pm
by ThinkGeekness
Thanks, I was trying to put the web link instead what the server sees it as.. Thanks again.