Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9018299
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T04:29:24+00:00 2026-06-16T04:29:24+00:00

Using SSI, I can simply include this in my HTML file and the output

  • 0

Using SSI, I can simply include this in my HTML file and the output of the CGI script is displayed on the page:

<!--#include virtual="script.cgi"-->

Now I’m trying to do the equivalent, but instead of a HTML file, it’s inside a PHP file. I’ve been researching this all day and every solution is giving me the following problems. I’ll list them each starting with the ones I thought should work as well as the obscure…


1) <?php include("script.cgi"); ?>

Result: No execution. This simply prints out the full content of the CGI file as if it was just a text file.


2) <?php virtual("script.cgi"); ?>

Result: Fatal error: Call to undefined function virtual() in test.php on line #.

This bothers me as everything I read indicates that this is the proper way to do it. I’m no expert in PHP but how can virtual be an “undefined function”? It’s listed in the official PHP docs as valid for PHP version 5.


3) <?php exec("script.cgi"); ?>

Result: Blank. Nothing.


4)

<?php
    $fd = fopen("script.cgi", "r");
    fpassthru($fd);
?>

Result: No execution. This simply prints out the full content of the CGI file as if it was just a text file.


5) <?php echo system("script.cgi"); ?>

Result: Mixed. It executes but the “result” of the CGI script is printed twice and it’s preceded by “Content-type: text/html”. This I don’t understand.

Content-type: text/html resultresult

And by removing the echo…

<?php system("script.cgi"); ?>, results in…

Content-type: text/html result


6) <?php print("/usr/bin/perl script.cgi"); ?>

Result: No execution. It simply prints out what’s contained after the print statement (/usr/bin/perl script.cgi). (I’m not surprised but somebody in a forum claimed this worked for them.)


So what do I need to do in order to execute and include the results of the CGI file? This seems like it should be easy but I don’t know what else to try.

I’m on an Apache/Linux server (cPanel) with access to edit the htaccess file. It’s running PHP version 5.2.17.

And yes, when I pull up the CGI file in my browser, it executes and displays the result, so we know the server is configured to execute CGI files.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-16T04:29:25+00:00Added an answer on June 16, 2026 at 4:29 am

    I’ve tried everything and nothing seems to work properly or at all. Therefore, for me, the only answer is that it just cannot or should not be done. Besides, mixing CGI/Perl with PHP is probably not the best practice.

    It shouldn’t too difficult to simply rewrite any small CGI/Perl scripts into PHP. Anything too large to re-write, then just sticking with Perl for the whole site would be best in those cases.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

What's the difference in using SSI include & JSP include? e.g. <!--#include virtual=&quot;page.jsp&quot; -->
I have a website where I'm using the SSI directive #include virtual. <!--#include virtual=_includes/top_nav.html
I have a navigation bar that I include using SSI in every page of
On my work i can see old sites using SSI to include huge parts
using this http://bl.ocks.org/950642 we can see how to add images to nodes, the question
I have a page using Paypal Payments Standard with buy one now buttons on
Using HTML 5, I want to play multiple sounds simultaneously. how can I do
How can I instruct XQuery to copy these SSI directives (HTML comments) from an
Using CI for the first time and i'm smashing my head with this seemingly
Using Location.getBearing(); I seem to get randomly changing bearings. Aka, I can turn the

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.