By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
455,636 Members | 2,360 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 455,636 IT Pros & Developers. It's quick & easy.

Help with paths

P: n/a
jpb
I have been using SSI would like to start using php

From what I have seen php does not support absolute paths like SSI
eg
<!--#include virtual="/inc/css-gateway.inc" -->
will work: but

<? include("/inc/css-gateway.inc") ?>

Warning: main(/inc/css-gateway.inc) [function.main]: failed to create
stream: No such file or directory in
/home/jpb/public_html/www/de/immobilien/main.php on line 15

Fatal error: main() [function.main]: Failed opening required
'/inc/css-gateway.inc' (include_path='.:/usr/share/php') in
/home/jpb/public_html/www/de/immobilien/main.php on line 15

<? include("../../inc/css-gateway.inc") ?>
this works as intended.
Is there any way of declaring the server "/" and using absolute path?

Paul


Jul 17 '05 #1
Share this Question
Share on Google+
4 Replies


P: n/a
jpb wrote:
I have been using SSI would like to start using php

From what I have seen php does not support absolute paths like SSI
eg
<!--#include virtual="/inc/css-gateway.inc" -->
will work: but

<? include("/inc/css-gateway.inc") ?>


try
<?php include("$_SERVER[DOCUMENT_ROOT]/inc/css-gateway.inc"); ?>
Jul 17 '05 #2

P: n/a
jpb wrote:
I have been using SSI would like to start using php

From what I have seen php does not support absolute paths like SSI
eg
<!--#include virtual="/inc/css-gateway.inc" -->
will work: but

<? include("/inc/css-gateway.inc") ?>

Warning: main(/inc/css-gateway.inc) [function.main]: failed to create
stream: No such file or directory in
/home/jpb/public_html/www/de/immobilien/main.php on line 15

Fatal error: main() [function.main]: Failed opening required
'/inc/css-gateway.inc' (include_path='.:/usr/share/php') in
/home/jpb/public_html/www/de/immobilien/main.php on line 15

<? include("../../inc/css-gateway.inc") ?>
this works as intended.
Is there any way of declaring the server "/" and using absolute path?

Paul

Since SSI was designed to be used from inside Apache it takes the root
of the system to be your webroot. PHP is not so limited it will always
think your system root is / or C:\ on windows. I don't know of any way
to change this action.

--
John Downey
http://delusive.dyn.ee
http://sage.dev.box.sk
http://blacksun.box.sk

Jul 17 '05 #3

P: n/a
jpb
On Fri, 24 Oct 2003 13:16:27 +0100, Kevin Thorpe wrote:
jpb wrote:
I have been using SSI would like to start using php

From what I have seen php does not support absolute paths like SSI eg
<!--#include virtual="/inc/css-gateway.inc" -->
will work: but

<? include("/inc/css-gateway.inc") ?>


try
<?php include("$_SERVER[DOCUMENT_ROOT]/inc/css-gateway.inc"); ?>


Thank you

It seems to work.

Paul

Jul 17 '05 #4

P: n/a
jpb
On Fri, 24 Oct 2003 14:26:53 +0200, jpb wrote:
On Fri, 24 Oct 2003 13:16:27 +0100, Kevin Thorpe wrote:
jpb wrote:
I have been using SSI would like to start using php

From what I have seen php does not support absolute paths like SSI eg
<!--#include virtual="/inc/css-gateway.inc" -->
will work: but

<? include("/inc/css-gateway.inc") ?>


try
<?php include("$_SERVER[DOCUMENT_ROOT]/inc/css-gateway.inc"); ?>


Thank you

It seems to work.

Paul


Well that was a short lived " I finally got something working"

On my Linux box:
echo $_SERVER[DOCUMENT_ROOT] ->/home/jpb/public_html/www and it works;
but on the server
echo $_SERVER[DOCUMENT_ROOT] ->/usr/local/apache/htdocs

the error log complain with the following

[Fri Oct 24 10:38:07 2003] [error] PHP Warning:
main(/usr/local/apache/htdocs/inc/css-gateway.inc): failed to open stream:
No such file or directory in
/mnt/home/www/canadian-dream.com/www/de/immobilien/main.php on line 15

[Fri Oct 24 10:38:07 2003] [error] PHP Warning: main(): Failed opening
'/usr/local/apache/htdocs/inc/css-gateway.inc' for inclusion
(include_path='.:/usr/local/lib/php') in
/mnt/home/www/canadian-dream.com/www/de/immobilien/main.php on line 15
So I guess it's back to the old SSI.

Paul

Jul 17 '05 #5

This discussion thread is closed

Replies have been disabled for this discussion.