Getting php to work from the root

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • fletch

    Getting php to work from the root

    Hi all.

    I am rerouting all requests through a script, dispatch.php, using a
    ..htaccess file, except on a few directories. dispatch.php then decides
    what code needs to be loaded to return the correct info.

    When calling the site root http://primo.localhost/ the result is sent
    as text/plain and is rendered as such by Firefox (though interestingly
    not IE, which renders the html)

    When calling the page http://primo.localhost/index I get the exact same
    content, but Firefox renders html, not text.

    Has anyone got any explanation for this behaviour? Or a way to fix it?
    I do not make any calls to header() in my code.

    ..htaccess:-
    php_value include_path
    ".:/home/sites/primo.localhost/web/:/home/sites/primo.localhost/primo/:/home/sites/primo.localhost/"
    RewriteEngine on
    RewriteCond $3 (.*$)
    RewriteCond $2 !zc
    RewriteCond $2 !rt
    RewriteCond $2 !html_version
    RewriteCond $2 !rt
    RewriteCond $2 !primo
    RewriteCond $3 !dispatch.php
    RewriteRule ((.*)/)?([^/]*)$ /dispatch.php

    php_value error_reporting 2047
    php_value display_errors on


    cheers
    fletch

  • fletch

    #2
    Re: Getting php to work from the root



    On Oct 10, 10:07 am, "fletch" <richard.a.flet c...@googlemail .com>
    wrote:
    Hi all.
    >
    I am rerouting all requests through a script, dispatch.php, using a
    .htaccess file, except on a few directories. dispatch.php then decides
    what code needs to be loaded to return the correct info.
    >
    When calling the site roothttp://primo.localhost/the result is sent
    as text/plain and is rendered as such by Firefox (though interestingly
    not IE, which renders the html)
    >
    When calling the pagehttp://primo.localhost/indexI get the exact same
    content, but Firefox renders html, not text.
    >
    Has anyone got any explanation for this behaviour? Or a way to fix it?
    I do not make any calls to header() in my code.
    >
    .htaccess:-
    php_value include_path
    ".:/home/sites/primo.localhost/web/:/home/sites/primo.localhost/primo/:/home/sites/primo.localhost/"
    RewriteEngine on
    RewriteCond $3 (.*$)
    RewriteCond $2 !zc
    RewriteCond $2 !rt
    RewriteCond $2 !html_version
    RewriteCond $2 !rt
    RewriteCond $2 !primo
    RewriteCond $3 !dispatch.php
    RewriteRule ((.*)/)?([^/]*)$ /dispatch.php
    >
    php_value error_reporting 2047
    php_value display_errors on
    >
    cheers
    fletch
    Can it be true that my problem stumps everyone?

    fletch

    Comment

    • Jerry Stuckle

      #3
      Re: Getting php to work from the root

      fletch wrote:
      >
      On Oct 10, 10:07 am, "fletch" <richard.a.flet c...@googlemail .com>
      wrote:
      >
      >>Hi all.
      >>
      >>I am rerouting all requests through a script, dispatch.php, using a
      >>.htaccess file, except on a few directories. dispatch.php then decides
      >>what code needs to be loaded to return the correct info.
      >>
      >>When calling the site roothttp://primo.localhost/the result is sent
      >>as text/plain and is rendered as such by Firefox (though interestingly
      >>not IE, which renders the html)
      >>
      >>When calling the pagehttp://primo.localhost/indexI get the exact same
      >>content, but Firefox renders html, not text.
      >>
      >>Has anyone got any explanation for this behaviour? Or a way to fix it?
      >>I do not make any calls to header() in my code.
      >>
      >>.htaccess:-
      >>php_value include_path
      >>".:/home/sites/primo.localhost/web/:/home/sites/primo.localhost/primo/:/home/sites/primo.localhost/"
      >>RewriteEngi ne on
      >>RewriteCond $3 (.*$)
      >>RewriteCond $2 !zc
      >>RewriteCond $2 !rt
      >>RewriteCond $2 !html_version
      >>RewriteCond $2 !rt
      >>RewriteCond $2 !primo
      >>RewriteCond $3 !dispatch.php
      >>RewriteRule ((.*)/)?([^/]*)$ /dispatch.php
      >>
      >>php_value error_reporting 2047
      >>php_value display_errors on
      >>
      >>cheers
      >>fletch
      >
      >
      Can it be true that my problem stumps everyone?
      >
      fletch
      >
      No, it probably means you haven't described the problem well enough for
      anyone to take a shot at it.

      How about code, etc. And perhaps a URL we could check?

      --
      =============== ===
      Remove the "x" from my email address
      Jerry Stuckle
      JDS Computer Training Corp.
      jstucklex@attgl obal.net
      =============== ===

      Comment

      • fletch

        #4
        Re: Getting php to work from the root



        On Oct 11, 9:31 pm, Jerry Stuckle <jstuck...@attg lobal.netwrote:
        fletch wrote:
        >
        On Oct 10, 10:07 am, "fletch" <richard.a.flet c...@googlemail .com>
        wrote:
        >
        >Hi all.
        >
        >I am rerouting all requests through a script, dispatch.php, using a
        >.htaccess file, except on a few directories. dispatch.php then decides
        >what code needs to be loaded to return the correct info.
        >
        >When calling the site roothttp://primo.localhost/theresult is sent
        >as text/plain and is rendered as such by Firefox (though interestingly
        >not IE, which renders the html)
        >
        >When calling the pagehttp://primo.localhost/indexIget the exact same
        >content, but Firefox renders html, not text.
        >
        >Has anyone got any explanation for this behaviour? Or a way to fix it?
        >I do not make any calls to header() in my code.
        >
        >.htaccess:-
        >php_value include_path
        >".:/home/sites/primo.localhost/web/:/home/sites/primo.localhost/primo/:/home/sites/primo.localhost/"
        >RewriteEngin e on
        >RewriteCond $3 (.*$)
        >RewriteCond $2 !zc
        >RewriteCond $2 !rt
        >RewriteCond $2 !html_version
        >RewriteCond $2 !rt
        >RewriteCond $2 !primo
        >RewriteCond $3 !dispatch.php
        >RewriteRule ((.*)/)?([^/]*)$ /dispatch.php
        >
        >php_value error_reporting 2047
        >php_value display_errors on
        >
        >cheers
        >fletch
        >
        Can it be true that my problem stumps everyone?
        >
        fletchNo, it probably means you haven't described the problem well enough for
        anyone to take a shot at it.
        >
        How about code, etc. And perhaps a URL we could check?
        >
        dispatch.php is only short, but calls Manager, which is 1097 lines.
        Manager then loads page objects and blocks as required to build the
        page. The code base is currently 25,601 lines, excluding templates. So
        no chance of anyone reading the code.

        Also, as stated in my orginal post the problem is not the content that
        is produced with my code, but with the browser on the client side,
        which is not interpreting the result as html.

        Don't worry, I'll figure it out.

        Comment

        • Jerry Stuckle

          #5
          Re: Getting php to work from the root

          fletch wrote:
          >
          On Oct 11, 9:31 pm, Jerry Stuckle <jstuck...@attg lobal.netwrote:
          >
          >>fletch wrote:
          >>
          >>
          >>>On Oct 10, 10:07 am, "fletch" <richard.a.flet c...@googlemail .com>
          >>>wrote:
          >>
          >>>>Hi all.
          >>
          >>>>I am rerouting all requests through a script, dispatch.php, using a
          >>>>.htaccess file, except on a few directories. dispatch.php then decides
          >>>>what code needs to be loaded to return the correct info.
          >>
          >>>>When calling the site roothttp://primo.localhost/theresult is sent
          >>>>as text/plain and is rendered as such by Firefox (though interestingly
          >>>>not IE, which renders the html)
          >>
          >>>>When calling the pagehttp://primo.localhost/indexIget the exact same
          >>>>content, but Firefox renders html, not text.
          >>
          >>>>Has anyone got any explanation for this behaviour? Or a way to fix it?
          >>>>I do not make any calls to header() in my code.
          >>
          >>>>.htaccess :-
          >>>>php_value include_path
          >>>>".:/home/sites/primo.localhost/web/:/home/sites/primo.localhost/primo/:/home/sites/primo.localhost/"
          >>>>RewriteEngi ne on
          >>>>RewriteCo nd $3 (.*$)
          >>>>RewriteCo nd $2 !zc
          >>>>RewriteCo nd $2 !rt
          >>>>RewriteCo nd $2 !html_version
          >>>>RewriteCo nd $2 !rt
          >>>>RewriteCo nd $2 !primo
          >>>>RewriteCo nd $3 !dispatch.php
          >>>>RewriteRu le ((.*)/)?([^/]*)$ /dispatch.php
          >>
          >>>>php_value error_reporting 2047
          >>>>php_value display_errors on
          >>
          >>>>cheers
          >>>>fletch
          >>
          >>>Can it be true that my problem stumps everyone?
          >>
          >>>fletchNo, it probably means you haven't described the problem well enough for
          >>
          >>anyone to take a shot at it.
          >>
          >>How about code, etc. And perhaps a URL we could check?
          >>
          >
          >
          dispatch.php is only short, but calls Manager, which is 1097 lines.
          Manager then loads page objects and blocks as required to build the
          page. The code base is currently 25,601 lines, excluding templates. So
          no chance of anyone reading the code.
          >
          Also, as stated in my orginal post the problem is not the content that
          is produced with my code, but with the browser on the client side,
          which is not interpreting the result as html.
          >
          Don't worry, I'll figure it out.
          >
          If you need some help, you need to give us something to work with. In
          your case you'd need to create a small test case showing the problem -
          not post the entire code.

          --
          =============== ===
          Remove the "x" from my email address
          Jerry Stuckle
          JDS Computer Training Corp.
          jstucklex@attgl obal.net
          =============== ===

          Comment

          Working...