SitePoint Sponsor

User Tag List

Results 1 to 12 of 12

Thread: SSI's in PHP?

  1. #1
    chown linux:users\ /world Hartmann's Avatar
    Join Date
    Aug 2000
    Location
    Houston, TX, USA
    Posts
    6,455
    Mentioned
    11 Post(s)
    Tagged
    0 Thread(s)
    If I insert an SSI in a .php page will the SSI be processed?
    Thanks,

  2. #2
    Fluffy Kitten Programmer~ Elledan's Avatar
    Join Date
    Jun 2000
    Location
    Netherlands
    Posts
    1,356
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Only if the server parses SSI tags in .php files

    Replace SSI tags with the PHP equivalent:

    <?php
    include("path/to/file.inc");
    ?>
    www.nyanko.ws - My web-, software- and game development company.
    www.mayaposch.com - My personal site and blog.

  3. #3
    SitePoint Zealot Ace Nova's Avatar
    Join Date
    Aug 2000
    Posts
    197
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    The real function that is absolutely identical to SSI in php is virtual().

    It will include every kind of file.

    Hope this helps
    Ace Nova
    Football Man
    InternetSprite.Com - Coming Soon!

  4. #4
    exit();
    Join Date
    Jul 2000
    Posts
    759
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    The include() function in PHP is great

    You can even include pages from other Web sites if your php.ini file allows it.

  5. #5
    SitePoint Evangelist
    Join Date
    May 2000
    Location
    Canada
    Posts
    533
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    to REALLY have SSI in a PHP file , use virtual() , as Ace Nova said...

    check out the following URL for a little snippet i wrote regarding this earlier

    http://www.geekarea.org/articles.php?action=show&id=10
    cogito, ergo sum

  6. #6
    SitePoint Addict
    Join Date
    Dec 2000
    Location
    BOSTON MA
    Posts
    335
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    hi,

    i'm trying to use virtual() instead of include() but i keep getting this error:

    Code:
    Fatal error: Call to undefined function: virtual() in /www/bla-bla/php-bin/signup.php on line 9
    i get the error when i use :

    Code:
    virtual("/ssi/top_nav.html");
    but it only works when i use :

    Code:
    include("../../ssi/top_nav.html");
    do i need to define the virtual() function beforehand? i thought that it was predefined in php.
    Last edited by atomicmunky; Feb 25, 2001 at 11:42.
    . . . chris

  7. #7
    SitePoint Wizard
    Join Date
    Apr 2000
    Posts
    1,483
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    It should be predefined but doesn't seem to be on your server - what version of PHP are you using?

    Since you're only including HTML files then include() should be just fine. It is only when you start including CGI etc that others are useful.

  8. #8
    SitePoint Addict
    Join Date
    Dec 2000
    Location
    BOSTON MA
    Posts
    335
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    PHP Version 4.0RC1

    does that mean anything?
    . . . chris

  9. #9
    SitePoint Author Kevin Yank's Avatar
    Join Date
    Apr 2000
    Location
    Melbourne, Australia
    Posts
    2,571
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    Do you know if PHP is set up as an Apache module, or are you running the CGI version? The CGI version does not support virtual() because it is run as an external program by the Web server.
    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

  10. #10
    SitePoint Addict
    Join Date
    Dec 2000
    Location
    BOSTON MA
    Posts
    335
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    the php interpreter is installed in the cgi-bin so does that mean that it's the cgi version?

    i'm almost positive that it is not, but you'd probably know better.
    . . . chris

  11. #11
    SitePoint Author Kevin Yank's Avatar
    Join Date
    Apr 2000
    Location
    Melbourne, Australia
    Posts
    2,571
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    Sounds like you're running the CGI version. An easy way to find out is to create and view the following script:
    PHP Code:
    <?php phpinfo(); ?>
    The version of PHP that you are using should be listed next to "Server API" at the top of the page.
    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

  12. #12
    SitePoint Addict
    Join Date
    Dec 2000
    Location
    BOSTON MA
    Posts
    335
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    cgi version definitely.

    SAPI=CGI

    thanks.
    . . . chris


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
  •