can php mysql work in Windows but not Solaris?

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Hal Halloway

    can php mysql work in Windows but not Solaris?

    can mysql work in Windows but not Solaris?
    Is there any reason you can see why the fulltext php/mysql code below
    works OK on my win2k php4.3.6. mysql 4.1.3 pc but does *not* work when
    put on a Solaris Server with php5 mysql 4.1.6 ?

    That is what happens...I'm suspicious of the accent characters in the
    code but I am not sure if there's any truth to my suspicion and how I'd
    even test or fix it(?) Here's the snip I think causes the problem:
    ....
    else {
    if ( $Type_Submit == 'radio_and') {
    $radio_keyword = preg_replace('/\s+|^/', ' +', $keyword);
    }
    elseif ( $Type_Submit == 'radio_phrase') {
    $radio_keyword = '"'.$keyword.'" ';
    }
    $query =
    "SELECT page.* FROM `page` LEFT JOIN `keywords` USING
    (`page_id`) WHERE MATCH (`keywords`.`ke yword_txt`)
    AGAINST ('$radio_keywor d' IN BOOLEAN MODE)
    UNION
    SELECT page.* FROM `page` WHERE MATCH (`title`, `descrip`)
    AGAINST ('$radio_keywor d' IN BOOLEAN MODE)
    UNION
    SELECT page.* FROM `page` LEFT JOIN `url_Pages` USING (`page_id`)
    WHERE MATCH (`url_Pages`.`p age_url`)
    AGAINST ('$radio_keywor d' IN BOOLEAN MODE)";
    $result = mysql_query($qu ery);
    }

    --
  • CJ Llewellyn

    #2
    Re: can php mysql work in Windows but not Solaris?

    "Hal Halloway" <Halloway@nospa m.net> wrote in message
    news:jOmGd.570$ Hg6.260@trnddc0 9...[color=blue]
    > can mysql work in Windows but not Solaris?
    > Is there any reason you can see why the fulltext php/mysql code below
    > works OK on my win2k php4.3.6. mysql 4.1.3 pc but does *not* work when
    > put on a Solaris Server with php5 mysql 4.1.6 ?
    >
    > That is what happens...I'm suspicious of the accent characters in the
    > code but I am not sure if there's any truth to my suspicion and how I'd
    > even test or fix it(?)[/color]

    By writing your code in a manner that detects errors and deals with them
    accordingly

    -snip-[color=blue]
    > $result = mysql_query($qu ery);
    > }[/color]


    $result = mysql_query($qu ery , $conn);
    if(! $result || mysql_error($co nn))
    {
    echo "Unable to process query [$query] : " . mysql_error($co nn);
    }


    Comment

    • Ken Robinson

      #3
      Re: can php mysql work in Windows but not Solaris?


      Hal Halloway wrote:[color=blue]
      > can mysql work in Windows but not Solaris?
      > Is there any reason you can see why the fulltext php/mysql code below
      > works OK on my win2k php4.3.6. mysql 4.1.3 pc but does *not* work[/color]
      when[color=blue]
      > put on a Solaris Server with php5 mysql 4.1.6 ?
      >
      > That is what happens...I'm suspicious of the accent characters in the
      > code but I am not sure if there's any truth to my suspicion and how[/color]
      I'd[color=blue]
      > even test or fix it(?) Here's the snip I think causes the problem:[/color]

      You posted the same query on www.tek-tips.com ...

      Here's my suggestions I posted there...

      Where are your variables being set? If they are coming from a form or
      the URL they this could be a problem with register_global s being set to
      "on" on the Windows 2K pc and being set set to "off" on the Solaris
      server.

      If your variables are coming from a POSTED form use the superglobal
      $_POST to retrieve the values. For instance assuming that your variable
      $radio_keyword comes from a form, use $_POST['radio_keyword'] to get
      the value. The same holds true if the variable comes from the URL,
      except you would use the superglobal $_GET.

      See http://www.php.net/ and read up on variable from outside of PHP.
      Ken

      Comment

      • News Me

        #4
        Re: can php mysql work in Windows but not Solaris?

        Hal Halloway wrote:[color=blue]
        > can mysql work in Windows but not Solaris?
        > Is there any reason you can see why the fulltext php/mysql code below
        > works OK on my win2k php4.3.6. mysql 4.1.3 pc but does *not* work when
        > put on a Solaris Server with php5 mysql 4.1.6 ?
        >
        > That is what happens...I'm suspicious of the accent characters in the
        > code but I am not sure if there's any truth to my suspicion and how I'd
        > even test or fix it(?) Here's the snip I think causes the problem:
        > ...
        > else {
        > if ( $Type_Submit == 'radio_and') {
        > $radio_keyword = preg_replace('/\s+|^/', ' +', $keyword);
        > }
        > elseif ( $Type_Submit == 'radio_phrase') {
        > $radio_keyword = '"'.$keyword.'" ';
        > }
        > $query =
        > "SELECT page.* FROM `page` LEFT JOIN `keywords` USING
        > (`page_id`) WHERE MATCH (`keywords`.`ke yword_txt`)
        > AGAINST ('$radio_keywor d' IN BOOLEAN MODE)
        > UNION
        > SELECT page.* FROM `page` WHERE MATCH (`title`, `descrip`)
        > AGAINST ('$radio_keywor d' IN BOOLEAN MODE)
        > UNION
        > SELECT page.* FROM `page` LEFT JOIN `url_Pages` USING (`page_id`)
        > WHERE MATCH (`url_Pages`.`p age_url`)
        > AGAINST ('$radio_keywor d' IN BOOLEAN MODE)";
        > $result = mysql_query($qu ery);
        > }
        >[/color]

        In addition to the things already recommended, while in the development
        stage, I like to use a flag to optionally print out my queries to see
        what they look like.

        $debug = true;
        ..
        ..
        if ($debug)
        {
        print "<pre>$quer y</re>";
        }
        $result = mysql_query($qu ery);

        One thing I noticed is you are wrapping the $keyword in double quotes
        when you put it into $radio_keyword, then you wrap that in single quotes
        when you build $query. So the SQL looks like

        AGAINST ('"my_keyword "' IN BOOLEAN MODE)

        I'm not sure how MySQL handles this. I.e., are the inner double quotes
        part of the keyword. Why this would differ on different paltforms is
        beyond me.

        NM

        --
        convert uppercase WORDS to single keystrokes to reply

        Comment

        • Hal Halloway

          #5
          Re: can php mysql work in Windows but not Solaris?



          Thanks for the posts. I use all the advice.

          Comment

          Working...