homepage Welcome to WebmasterWorld Guest from 54.204.127.191
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Pubcon Platinum Sponsor 2014
Home / Forums Index / Code, Content, and Presentation / PHP Server Side Scripting
Forum Library, Charter, Moderators: coopster & jatar k

PHP Server Side Scripting Forum

    
How to use SSI in PHP
Need to make SSI to run in PHP
Uzil




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

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?

 

StupidScript




msg:3041513
 5:35 pm on Aug 10, 2006 (gmt 0)

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.

NameNick




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

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

NN

Uzil




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

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.

Uzil




msg:3042613
 1:37 pm on Aug 11, 2006 (gmt 0)

OK got it!

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

Thanks all

StupidScript




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

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]

Global Options:
 top home search open messages active posts  
 

Home / Forums Index / Code, Content, and Presentation / PHP Server Side Scripting
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved