SitePoint Sponsor

User Tag List

Results 1 to 11 of 11
  1. #1
    psycho
    Join Date
    May 2000
    Location
    London
    Posts
    283
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I need apache to parse *.html and *.php for PHP & SSI.

    What should i add ?

    at the moment i have :

    AddType application/x-httpd-php3 .php
    AddType application/x-httpd-php3 .html
    addType text/x-server-parsed-html .html

    When i use a .html, it doesn't parse for php.

    What should the correct code be ?


    Thanks
    James

  2. #2
    SitePoint Author Kevin Yank's Avatar
    Join Date
    Apr 2000
    Location
    Melbourne, Australia
    Posts
    2,571
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    To my knowledge, you can't parse a single file type for both PHP and SSI. You'll have to choose one or the other.
    Kevin Yank
    CTO, sitepoint.com
    I wrote: Simply JavaScript | BYO PHP/MySQL | Tech Times | Editize
    Baby’s got back—a hard back, that is: The Ultimate CSS Reference

  3. #3
    psycho
    Join Date
    May 2000
    Location
    London
    Posts
    283
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    damn.

    ok, well how do i get the effect of SSI to run a script.

    at the moment i have this :

    <!--#include virtual="/stato/stats.cgi"-->

    how can i get this effect in PHP ?

    <?php require("/stato/stats.cgi"); ?>

    is it that ?

  4. #4
    SitePoint Author Kevin Yank's Avatar
    Join Date
    Apr 2000
    Location
    Melbourne, Australia
    Posts
    2,571
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    Normally, you'd just do:

    include('filetoinclude.php');

    But since the file you're including is a CGI that must be processed, you should instead use

    passthru('/path/to/script.cgi');
    Kevin Yank
    CTO, sitepoint.com
    I wrote: Simply JavaScript | BYO PHP/MySQL | Tech Times | Editize
    Baby’s got back—a hard back, that is: The Ultimate CSS Reference

  5. #5
    psycho
    Join Date
    May 2000
    Location
    London
    Posts
    283
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    that isn't by any chance only PHP4 ?

  6. #6
    SitePoint Author Kevin Yank's Avatar
    Join Date
    Apr 2000
    Location
    Melbourne, Australia
    Posts
    2,571
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    No, but it's only on the Apache module version of PHP (i.e. won't work with the CGI version).

    What problem(s) are you having?
    Kevin Yank
    CTO, sitepoint.com
    I wrote: Simply JavaScript | BYO PHP/MySQL | Tech Times | Editize
    Baby’s got back—a hard back, that is: The Ultimate CSS Reference

  7. #7
    psycho
    Join Date
    May 2000
    Location
    London
    Posts
    283
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    well, it just returns a page with this code :

    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
    <HTML><HEAD>
    <META http-equiv=Content-Type content="text/html; charset=windows-1252"></HEAD>
    <BODY></BODY></HTML>


    Instead of what Statomatic should return, which is this :

    <!-- Statomatic v2.2 -->

    The code I'm using is :

    <?php passthru("/stato/stats.cgi"); ?>

  8. #8
    psycho
    Join Date
    May 2000
    Location
    London
    Posts
    283
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    OK, passthru wasn't working.

    I asked someone in #php on efnet, and they suggested using

    virtual();

    this works fine.

    thanks
    james

  9. #9
    psycho
    Join Date
    May 2000
    Location
    London
    Posts
    283
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    using virtual(); seems to work, but i seem not to be getting some of the stats. eg referer.

    is this because of not using SSI ? would using this method provide exactly the same method as using SSI ?

  10. #10
    SitePoint Author Kevin Yank's Avatar
    Join Date
    Apr 2000
    Location
    Melbourne, Australia
    Posts
    2,571
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    It's quite possible that some of the request-specific environment variables are not available to a CGI called with virtual(). This function is equivalent to <!--#include virtual...--> using SSI.

    In an ideal world, you would port your CGI to PHP; however, I assume this is beyond your experience?
    Kevin Yank
    CTO, sitepoint.com
    I wrote: Simply JavaScript | BYO PHP/MySQL | Tech Times | Editize
    Baby’s got back—a hard back, that is: The Ultimate CSS Reference

  11. #11
    psycho
    Join Date
    May 2000
    Location
    London
    Posts
    283
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Unfortunately not. Plus, its a pre-compiled C++ script.

    Guess I'll have to use the javascript image tag version. But this messes up the layout. Doh !


Bookmarks

Posting Permissions

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