Ask a Question related to PHP Development, Design and Development.

  1. #1

    Default Help with paths

    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




    jpb Guest

  2. Similar Questions and Discussions

    1. How do I do this... re-paths
      I am sure that this is a simple task, and hopefully I can give an uncomplicated description of what I am trying to do. I have a complex rectangular...
    2. Strokes to paths
      Is there a quick and easy way to convert strokes to paths (defined as a vector) in MX?
    3. Bringing paths into Photoshop from AI as PATHS
      What happened to bringing paths into Photoshop from Illustrator as PATHS? Used to be able to copy paths into Photoshop from AI 8 as a path. Can this...
    4. Paths
      Hi All After converting text to paths, is it possible in FH9 to unconvert it after it has been saved so undo won't work -- Kind Regards Gina...
    5. need general help with setting paths & man paths for apps
      On Thu, 10 Jul 2003, solaris newbie wrote: That is one way, but a (perhaps) beter way would be to modify PATH in individual user's .profile. ...
  3. #2

    Default Re: Help with paths

    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"); ?>


    Kevin Thorpe Guest

  4. #3

    Default Re: Help with paths

    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

    jpb Guest

  5. #4

    Default Re: Help with paths

    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
    [url]http://delusive.dyn.ee[/url]
    [url]http://sage.dev.box.sk[/url]
    [url]http://blacksun.box.sk[/url]

    John Downey Guest

  6. #5

    Default Re: Help with paths

    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

    jpb Guest

Posting Permissions

  • You may not post new threads
  • You may post replies
  • You may not post attachments
  • You may not edit your posts

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139