470,832 Members | 2,108 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 470,832 developers. It's quick & easy.

Help with paths

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
4 2165
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
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
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
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.

Similar topics

7 posts views Thread by Timothy Madden | last post: by
1 post views Thread by malcolm | last post: by
reply views Thread by Chris Gill | last post: by
1 post views Thread by Rahul | last post: by
5 posts views Thread by costantinos | last post: by
6 posts views Thread by Jon Slaughter | last post: by
5 posts views Thread by Justin | last post: by
reply views Thread by mihailmihai484 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.