Problem with Apache 1.3.28/PHP 4.3.3 on XP

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Nick Rees

    Problem with Apache 1.3.28/PHP 4.3.3 on XP

    Hi,

    I've got a strange query that I can't figure out. I've got a new
    installation of Apache 1.3.28 and PHP 4.3.3 on my laptop, but it
    doesn't appear to be processing URLs correctly. I've tried to do a
    direct copy of my config on my desktop (which is Apache 1.3.27 and PHP
    4.3.1, I think), but I don't have access to it any more to check the
    config files.

    Apache works fine, I installed it first and tested it with several
    pages. They all get served nicely.

    PHP itself works fine, it processes and serves files correctly, with
    only one apparent problem.

    If you pass a URL such as :



    I still get the same result as if i'd typed in :



    I added a line to print out the variables at the top of the page, and
    all of them are empty. Regardless of what you put in.

    If you need an example :



    this is the same file (with only mods for usernames/passwords for
    different servers) and it works perfectly on my webhost. Click on the
    'Next' and 'Prev' photos on the right to scroll through the pictures.

    Here is the primary code that is of concern :

    <html>
    <head>
    <meta http-equiv="Content-Type" content="text/html;
    charset=windows-1252">
    <title>Image Viewer</title>
    <base target="_self">
    </head>

    <body bgcolor="#00000 0" text="#0080FF" topmargin="5" leftmargin="5">

    <table border="0" width="100%">
    <?php

    // Connect to the local server
    $dbcnx = @mysql_connect( "localhost" , "Visitor", "galleryvisitor ");
    if (!$dbcnx)
    {
    echo( "<p>Databas e server unavailable<p>" );
    exit();
    }

    // Connect to the Gallery database
    if (! @mysql_select_d b("gallery", $dbcnx) )
    {
    echo( "<p>Unable to access The Gallery database<p>" );
    exit();
    }

    // test for optional selections
    $query_str = "";
    if ($PID != NULL)
    {
    $query_str = " WHERE PID LIKE \"" . $PID . "\"";
    }

    echo("<p>Query string '1' is : \"" . $query_str . "\" ¦ PID : \"" .
    $PID . "\" ¦ Mode : \"" . $Mode . "\"<p>");

    if ($PID == NULL)
    {
    $mode = "Photo";
    $query_str = " WHERE PID LIKE \"F1P01\"";
    }

    $result = @mysql_query("S ELECT * FROM canada_0303" . $query_str);
    if (!$result)
    {
    echo("<p>Query for image data failed : " . mysql_error() . "<p>");
    exit();
    }

    Does anyone have any suggestions or questions? I've tried these files
    in both Mozilla and IE, and they both produce the same results.

    Many thanks in advance.

    Nick.
  • FredBriand

    #2
    Re: Problem with Apache 1.3.28/PHP 4.3.3 on XP

    Nick Rees a écrit :[color=blue]
    > Hi,
    >
    > I've got a strange query that I can't figure out. I've got a new
    > installation of Apache 1.3.28 and PHP 4.3.3 on my laptop, but it
    > doesn't appear to be processing URLs correctly. I've tried to do a
    > direct copy of my config on my desktop (which is Apache 1.3.27 and PHP
    > 4.3.1, I think), but I don't have access to it any more to check the
    > config files.
    >
    > Apache works fine, I installed it first and tested it with several
    > pages. They all get served nicely.
    >
    > PHP itself works fine, it processes and serves files correctly, with
    > only one apparent problem.
    >
    > If you pass a URL such as :
    >
    > http://127.0.0.1/gallery/canada_0303...P02&mode=Photo
    >
    > I still get the same result as if i'd typed in :
    >
    > http://127.0.0.1/gallery/canada_0303/imgquery.php
    >
    > I added a line to print out the variables at the top of the page, and
    > all of them are empty. Regardless of what you put in.
    >
    > If you need an example :
    >
    > http://www.novaldex.com/gallery/cana...3/imgquery.php
    >
    > this is the same file (with only mods for usernames/passwords for
    > different servers) and it works perfectly on my webhost. Click on the
    > 'Next' and 'Prev' photos on the right to scroll through the pictures.
    >
    > Here is the primary code that is of concern :
    >
    > <html>
    > <head>
    > <meta http-equiv="Content-Type" content="text/html;
    > charset=windows-1252">
    > <title>Image Viewer</title>
    > <base target="_self">
    > </head>
    >
    > <body bgcolor="#00000 0" text="#0080FF" topmargin="5" leftmargin="5">
    >
    > <table border="0" width="100%">
    > <?php
    >
    > // Connect to the local server
    > $dbcnx = @mysql_connect( "localhost" , "Visitor", "galleryvisitor ");
    > if (!$dbcnx)
    > {
    > echo( "<p>Databas e server unavailable<p>" );
    > exit();
    > }
    >
    > // Connect to the Gallery database
    > if (! @mysql_select_d b("gallery", $dbcnx) )
    > {
    > echo( "<p>Unable to access The Gallery database<p>" );
    > exit();
    > }
    >
    > // test for optional selections
    > $query_str = "";
    > if ($PID != NULL)
    > {
    > $query_str = " WHERE PID LIKE \"" . $PID . "\"";
    > }
    >
    > echo("<p>Query string '1' is : \"" . $query_str . "\" ¦ PID : \"" .
    > $PID . "\" ¦ Mode : \"" . $Mode . "\"<p>");
    >
    > if ($PID == NULL)
    > {
    > $mode = "Photo";
    > $query_str = " WHERE PID LIKE \"F1P01\"";
    > }
    >
    > $result = @mysql_query("S ELECT * FROM canada_0303" . $query_str);
    > if (!$result)
    > {
    > echo("<p>Query for image data failed : " . mysql_error() . "<p>");
    > exit();
    > }
    >
    > Does anyone have any suggestions or questions? I've tried these files
    > in both Mozilla and IE, and they both produce the same results.
    >
    > Many thanks in advance.
    >
    > Nick.[/color]
    The problem comes from the fact that environment variables and so on are
    no longer global variables by default. In order to get the value of a
    "get" variable, you must type:
    $query_str = " WHERE PID LIKE \"" . $_GET["PID"] . "\"";

    Same for "post", "server", "session".. .

    Check the doc for the whole thing:


    fred.

    Comment

    • Nick Rees

      #3
      Re: Problem with Apache 1.3.28/PHP 4.3.3 on XP

      FredBriand <ZYXfredbriandX YZ@ZXYblueboxst udioXYZ.net> wrote in message news:<bk17nj$u4 g$1@news-reader1.wanadoo .fr>...
      [color=blue]
      > The problem comes from the fact that environment variables and so on are
      >
      > no longer global variables by default. In order to get the value of a
      > "get" variable, you must type:
      > $query str = " WHERE PID LIKE \"" . $ GET["PID"] . "\"";
      >
      > Same for "post", "server", "session".. .
      >
      > Check the doc for the whole thing:
      > http://fr2.php.net/manual/en/languag...predefined.php
      >
      > fred.[/color]

      Hi Fred, thanks for your post.

      Modified my code as you described above (but needed to change that '$
      GET' to '$_GET') and it worked a treat.

      Can't quite figure out why it worked perfectly well on my desktop and
      my domain though . . . must be a setting somewhere in the .ini/config
      files. I'll make the necessary modifications and reload all the pages.

      Thanks for your help!

      Nick.

      Comment

      Working...