Home » Forum

Announcement

Collapse
No announcement yet.

Server side scripting on search_template.html

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • Server side scripting on search_template.html

    Hi,

    Have a quick question. I've been using Zoom for about 2 years now(v6) and have made quite a few websites now and usually always need to create a search page in php. I always use this code and it works:

    <?php
    $QSTRING = $_SERVER['QUERY_STRING'];
    $REMADDR = $_SERVER['REMOTE_ADDR'];
    putenv("REQUEST_METHOD=GET");
    putenv("QUERY_STRING=$QSTRING");
    putenv("REMOTE_ADDR=$REMADDR");
    // absolute path to search.cgi required below
    $output = shell_exec("C:\inetpub\wwwroot\search\search.cgi") ;
    $output = ereg_replace("Content-type: text/html;", "", $output);
    echo $output;
    ?>

    So I created a new website and using this code, I could not get it to work. I came here and copied the code from the tutorial which was this:

    <?php
    $QSTRING = $_SERVER['QUERY_STRING'];
    $REMADDR = $_SERVER['REMOTE_ADDR'];
    putenv("REQUEST_METHOD=GET");
    putenv("QUERY_STRING=$QSTRING");
    putenv("REMOTE_ADDR=$REMADDR");
    // absolute path to search.cgi required below
    $output = shell_exec("C:\\inetpub\\wwwroot\\search\\search.c gi");
    $output = ereg_replace("Content-type: text/html;", "", $output);
    echo $output;
    ?>

    My only conclusion was my absolute path was wrong, it need the double \\ not just one \

    But if that is the case then why did it work for my other sites?

    Just curious, would like to know exactly what went wrong here for future reference.

    Thanks!

  • #2
    Maybe the version of PHP was different on the different servers?

    Comment


    • #3
      Ray,

      Same server, same PHP version. Currently using PHP 5.5.11.

      -

      Comment


      • #4
        You probably had different PHP settings. Maybe you had PHP Safe Mode enabled on one and not the other.

        Other people discussing this problem with PHP and windows paths:
        http://stackoverflow.com/questions/1...th-not-running
        --Ray
        Wrensoft Web Software
        Sydney, Australia
        Zoom Search Engine

        Comment

        Working...
        X