Welcome to WebmasterWorld Guest from 54.167.252.62

Forum Moderators: coopster & jatar k

Message Too Old, No Replies

How to use SSI in PHP

Need to make SSI to run in PHP

     
5:11 pm on Aug 10, 2006 (gmt 0)

10+ Year Member



I'm doing the configuration of somebody else PHP script and i need to make SSI to run in the html tags that are in the PHP script.
I've done a couple of tries and the SSI tags are just ignored, nothing happen?
5:35 pm on Aug 10, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



You are probably encountering an issue with the filetypes the server is configured to allow standard SSI with. If you are within a PHP script, you should use PHP include syntax. Here is one example:

<?php

include "somefile.php";

?>

Note that there are many SSI directives, and all of them have PHP alternatives.

9:22 am on Aug 11, 2006 (gmt 0)

10+ Year Member



The alternative of SSI in PHP would be virtual().

NN

11:21 am on Aug 11, 2006 (gmt 0)

10+ Year Member



Well the:
<?php
include "somefile.php";
?>
Works fine but the problem is that the "somefile.php" is actually "somefile.cgi" and what i get is the full code of the Perl,like:
#!/usr/bin/perluse strict;use CGI;use part2;use part3;....
....the rest of the php document.
Even calling the include function in the end of the php script it always come in the top of the page.
1:37 pm on Aug 11, 2006 (gmt 0)

10+ Year Member



OK got it!

it have to be:
virtual ("somefile.cgi");

Thanks all

5:05 pm on Aug 11, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Glad you got it.

virtual() [us2.php.net] and include() [us3.php.net] each have their place.

As you have discovered,

virtual()
is similar in functionality to Apache's mod_include (SSI)
<!--#include virtual="somescript.cgi" -->
functionality. Likewise, PHP's
include()
is similar to a standard SSI file inclusion
<!--#include file="somefile.html" -->
. As I noted, all of the Apache mod_include (SSI) functions have a PHP alternative, it just depends on what you need.

Good work getting what you needed! ;)

[edited by: StupidScript at 5:12 pm (utc) on Aug. 11, 2006]

 

Featured Threads

Hot Threads This Week

Hot Threads This Month