php's include function question

    Date: 04/28/06 (PHP Community)    Keywords: php, browser, html, web, apache

    I currently have a paid webhost, which runs *nix, I have a web proxy script running on there and rather than calling the script directly, I use the
    include('cgi-bin/proxy.pl');
    ?>
    function to load it in an index.php file on my webserver.

    Now I also have a local webserver, running Win2k3, Apache 2.0.55, the latest PHP, and Perl. (I'm not sure if its a misconfiguration on my part, or if theres something I'm doing wrong...) I setup everything, Installed the same proxy script (and when accessed directly, it runs exactly as it should,) But when I use the include('cgi-bin/proxy.pl'); function, It just returns the entire cgi script in plaintext exactly like this:
    #!/usr/bin/perl --## CGIProxy 2.0.1## nph-proxy.cgi-- CGIProxy 2.0.1: a proxy in the form of a CGI script.# Retrieves the resource at any HTTP or FTP URL, updating embedded URLs# in HTML resources to point back through this script. By default, no# user info is sent to the server. Options include text-only proxying# to save bandwidth, cookie filtering, ad filtering, script removal,# user-defined encoding of the target URL, and more. Requires Perl 5.## Copyright (C) 1996, 1998-2002 by James Marshall, james@jmarshall.com# All rights reserved.## For the latest, see http://www.jmarshall.com/tools/cgiproxy/### IMPORTANT NO

    I've also tried using the full URL in the include path include('http://mysiteurl/cgi-bin/proxy.pl'); But that causes it to timeout, and gives the following errors:

    Warning: include(http://mysiteurl/cgi-bin/proxy.pl) [function.include]:failed to open stream: A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond. in D:\WebServer\htdocs2\public\index.php on line 5

    Warning: include() [function.include]: Failed opening 'http://mysiteurl/cgi-bin/proxy.pl' for inclusion (include_path='.') in D:\WebServer\htdocs2\public\index.php on line 5


    This also happens when I try to "include" any other file by the complete url... I'd like to figure out what's causing this, and why it can't read it from the complete url (all files I've tested, can be accessed fine via a web browser by the full URL, so I don't know why Apache / PHP is having a hard time with it.)

    I'm not quite sure where the problem is, But the first way of calling it include('cgi-bin/proxy.pl'); Obviously works, it just doesn't execute the cgi script before displaying it (which my paid webhost apparently does) How does one accomplish this?

    I'm by far no expert with PHP, I can piece together scripts and things, and do basic setting up, but this has really baffled me. :(


    ---Edit---
    Here are some actual domains so you can see what I really mean:

    My Webserver (Win2k3, Apache, PHP, Perl):
    The actual CGI Script (This runs fine):
    http://proxytest.dyndns.org/cgi-bin/nph-proxy.pl
    The PHP file using the include function to load the cgi script (Displays the actual CGI file in plaintext):
    http://proxytest.dyndns.org/proxy.php

    My Paid Host (Pre-configured, running on *nix):
    The actual CGI Script (This runs fine):
    http://www.wolfstudios3d.ca/cgi-bin/nph-proxy.pl
    The PHP file using the include function to load the cgi script (Displays the processed CGI File, exactly as if accessed directly):
    http://www.wolfstudios3d.ca/proxy.php

    Source: http://community.livejournal.com/php/445071.html

« PHP Links/Link Exchange... || Config file encryption »


antivirus | apache | asp | blogging | browser | bugtracking | cms | crm | css | database | ebay | ecommerce | google | hosting | html | java | jsp | linux | microsoft | mysql | offshore | offshoring | oscommerce | php | postgresql | programming | rss | security | seo | shopping | software | spam | spyware | sql | technology | templates | tracker | virus | web | xml | yahoo | home