MySQLi problem in PHP

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Malcolm Wright

    MySQLi problem in PHP

    Although I've been programming for over 30 years I am new to web
    development.
    As an introduction I've been using a book "PHP and MYSQL Web
    Development" by Luke Welling and Laura Thomson.
    I've set up an Apache Server v1.3.31.
    I've also installed MySQL V5.0.13 and PHP v 5.0.5.
    I've gone through the installations several times. I'm reasonably
    confident about the Apache Server but I have a problem with the
    interaction of the PHP and MYSql.
    I'm trying to connect to a MySQL database using PHP. I'm using the new
    mysqli_connect structure. I've also tried the straight procedural
    version mysqli_connect function.
    When I run the code I get a "Call to undefined function mysqli_connect" .
    I've set up my PHP.ini file to point to the correct php ext file and
    I've included references to the php_mysqli.dll but I still get the error
    message.
    In addition if I stop and then restart the Apache server - which is
    linked into PHP - I get an error message saying that PHP can't find the
    module php_mysqli.dll.
    I'm sure I have defined my extension_dir correctly as
    extension_dir = "C:/PHP/ext/"
    I know the dll is in this directory but it is not getting picked up. As
    this is currently a total block can anyone help please!

    Thanks

    Malcolm

  • Mark Rees

    #2
    Re: MySQLi problem in PHP

    The first thing to check is if your installation is using the version of
    php.ini which you think it is.

    Run a script containing only
    phpinfo();

    and take a look.

    If that's all OK, then did you stop IIS when installing PHP and Apache? If
    not, try uninstalling and reinstalling with IIS stopped.

    Cheers

    Mark
    [color=blue]
    > Although I've been programming for over 30 years I am new to web
    > development.
    > As an introduction I've been using a book "PHP and MYSQL Web
    > Development" by Luke Welling and Laura Thomson.
    > I've set up an Apache Server v1.3.31.
    > I've also installed MySQL V5.0.13 and PHP v 5.0.5.
    > I've gone through the installations several times. I'm reasonably
    > confident about the Apache Server but I have a problem with the
    > interaction of the PHP and MYSql.
    > I'm trying to connect to a MySQL database using PHP. I'm using the new
    > mysqli_connect structure. I've also tried the straight procedural
    > version mysqli_connect function.
    > When I run the code I get a "Call to undefined function mysqli_connect" .
    > I've set up my PHP.ini file to point to the correct php ext file and
    > I've included references to the php_mysqli.dll but I still get the error
    > message.
    > In addition if I stop and then restart the Apache server - which is
    > linked into PHP - I get an error message saying that PHP can't find the
    > module php_mysqli.dll.
    > I'm sure I have defined my extension_dir correctly as
    > extension_dir = "C:/PHP/ext/"
    > I know the dll is in this directory but it is not getting picked up. As
    > this is currently a total block can anyone help please![/color]



    Comment

    • Malcolm Wright

      #3
      Re: MySQLi problem in PHP

      Mark thanks but....
      Mark Rees wrote:[color=blue]
      >
      > The first thing to check is if your installation is using the version of
      > php.ini which you think it is.
      >
      > Run a script containing only
      > phpinfo();
      >[/color]
      Did that and it looks as if its using the php.ini in c:/php which is
      what I would expect.[color=blue]
      > and take a look.
      >
      > If that's all OK, then did you stop IIS when installing PHP and Apache? If
      > not, try uninstalling and reinstalling with IIS stopped.
      >[/color]
      Don't have IIS installed. IIS is a server (I think!) and I'm using the
      Apache server.
      I stop the Apache server every time that I made a change to php.ini and
      then restarted but it still doesn't see the php_mysqli.dll.

      Malcolm
      [color=blue]
      > Cheers
      >
      > Mark[/color]
      [color=blue]
      >
      >[color=green]
      >>Although I've been programming for over 30 years I am new to web
      >>development .[/color][/color]
      ....
      [color=blue][color=green]
      >>I'm trying to connect to a MySQL database using PHP. I'm using the new
      >>mysqli_connec t structure. I've also tried the straight procedural
      >>version mysqli_connect function.
      >>When I run the code I get a "Call to undefined function mysqli_connect" .
      >>I've set up my PHP.ini file to point to the correct php ext file and
      >>I've included references to the php_mysqli.dll but I still get the error
      >>message.[/color][/color]
      ....


      Comment

      • Raqueeb Hassan

        #4
        Re: MySQLi problem in PHP

        Well, what your phpinfo(); script says? Check the manual for it's
        specific location of php.ini file. This file location matters!

        Don't loose your hair rightaway! You might forget about all these
        installaton troubles, just get a full php+mysql+apach e package on
        windows ... like xampp!



        with MySQL 4.1.15 and PHP 5.0.5 ....

        Just download the whole package and extract that to some root drive
        a-n-d you are on the run!


        --
        Raqueeb Hassan
        Bangladesh

        Comment

        • Malcolm Wright

          #5
          Re: MySQLi problem in PHP

          Raqueeb Hassan wrote:[color=blue]
          > Well, what your phpinfo(); script says? Check the manual for it's
          > specific location of php.ini file. This file location matters!
          >
          > Don't loose your hair rightaway! You might forget about all these
          > installaton troubles, just get a full php+mysql+apach e package on
          > windows ... like xampp!
          >
          > http://www.apachefriends.org/en/xampp.html
          >
          > with MySQL 4.1.15 and PHP 5.0.5 ....
          >
          > Just download the whole package and extract that to some root drive
          > a-n-d you are on the run!
          >
          >
          > --
          > Raqueeb Hassan
          > Bangladesh
          >
          >[/color]
          Thanks for this tip Raqueeb. I've downloaded and got it working though
          I'm still having problems. Do you know into what directory I have to put
          the PHP source files?

          Cheers

          Malcolm

          Comment

          • Jerry Stuckle

            #6
            Re: MySQLi problem in PHP

            Malcolm Wright wrote:[color=blue]
            > Raqueeb Hassan wrote:
            >[color=green]
            >> Well, what your phpinfo(); script says? Check the manual for it's
            >> specific location of php.ini file. This file location matters!
            >>
            >> Don't loose your hair rightaway! You might forget about all these
            >> installaton troubles, just get a full php+mysql+apach e package on
            >> windows ... like xampp!
            >>
            >> http://www.apachefriends.org/en/xampp.html
            >>
            >> with MySQL 4.1.15 and PHP 5.0.5 ....
            >>
            >> Just download the whole package and extract that to some root drive
            >> a-n-d you are on the run!
            >>
            >>
            >> --
            >> Raqueeb Hassan
            >> Bangladesh
            >>
            >>[/color]
            > Thanks for this tip Raqueeb. I've downloaded and got it working though
            > I'm still having problems. Do you know into what directory I have to put
            > the PHP source files?
            >
            > Cheers
            >
            > Malcolm
            >[/color]

            Malcolm,

            It's also possible Apache can't load the MySQL client library
            (libmysqlclient .lib or mysqlclient.lib ). Ensure this library is in a
            path where it can be loaded.

            What happens if you type just

            mysql

            at a command prompt? This will load the mysql command interpreter.

            --
            =============== ===
            Remove the "x" from my email address
            Jerry Stuckle
            JDS Computer Training Corp.
            jstucklex@attgl obal.net
            =============== ===

            Comment

            • Malcolm Wright

              #7
              Re: MySQLi problem in PHP

              Jerry Stuckle wrote:[color=blue]
              > Malcolm Wright wrote:
              >[color=green]
              >> Raqueeb Hassan wrote:
              >>[color=darkred]
              >>> Well, what your phpinfo(); script says? Check the manual for it's
              >>> specific location of php.ini file. This file location matters!
              >>>
              >>> Don't loose your hair rightaway! You might forget about all these
              >>> installaton troubles, just get a full php+mysql+apach e package on
              >>> windows ... like xampp!
              >>>
              >>> http://www.apachefriends.org/en/xampp.html
              >>>
              >>> with MySQL 4.1.15 and PHP 5.0.5 ....
              >>>
              >>> Just download the whole package and extract that to some root drive
              >>> a-n-d you are on the run!
              >>>
              >>>
              >>> --
              >>> Raqueeb Hassan
              >>> Bangladesh
              >>>
              >>>[/color]
              >> Thanks for this tip Raqueeb. I've downloaded and got it working though
              >> I'm still having problems. Do you know into what directory I have to
              >> put the PHP source files?
              >>
              >> Cheers
              >>
              >> Malcolm
              >>[/color]
              >
              > Malcolm,
              >
              > It's also possible Apache can't load the MySQL client library
              > (libmysqlclient .lib or mysqlclient.lib ). Ensure this library is in a
              > path where it can be loaded.
              >
              > What happens if you type just
              >
              > mysql
              >
              > at a command prompt? This will load the mysql command interpreter.
              >[/color]
              Hi Jenny,
              Yes it responds with the mysql prompt and login. I can there get to the
              normal mysql functionality. I set all the neccessary paths - which made
              it all the more confusing that it couldn't see the dll.
              Thanks

              Malcolm

              Comment

              • Malcolm Wright

                #8
                Re: MySQLi problem in PHP

                Jerry Stuckle wrote:[color=blue]
                > Malcolm Wright wrote:
                >[color=green]
                >> Raqueeb Hassan wrote:
                >>[color=darkred]
                >>> Well, what your phpinfo(); script says? Check the manual for it's
                >>> specific location of php.ini file. This file location matters!
                >>>
                >>> Don't loose your hair rightaway! You might forget about all these
                >>> installaton troubles, just get a full php+mysql+apach e package on
                >>> windows ... like xampp!
                >>>
                >>> http://www.apachefriends.org/en/xampp.html
                >>>
                >>> with MySQL 4.1.15 and PHP 5.0.5 ....
                >>>
                >>> Just download the whole package and extract that to some root drive
                >>> a-n-d you are on the run!
                >>>
                >>>
                >>> --
                >>> Raqueeb Hassan
                >>> Bangladesh
                >>>
                >>>[/color]
                >> Thanks for this tip Raqueeb. I've downloaded and got it working though
                >> I'm still having problems. Do you know into what directory I have to
                >> put the PHP source files?
                >>
                >> Cheers
                >>
                >> Malcolm
                >>[/color]
                >
                > Malcolm,
                >
                > It's also possible Apache can't load the MySQL client library
                > (libmysqlclient .lib or mysqlclient.lib ). Ensure this library is in a
                > path where it can be loaded.
                >
                > What happens if you type just
                >
                > mysql
                >
                > at a command prompt? This will load the mysql command interpreter.
                >[/color]
                Strangely enough there was another person with exactly the same problem
                as I was having - see "PHP Configuration Troubles" further down this
                newsgroup. I followed the advice given in that answer, upgraded to
                Apache2 and copied libraries as suggested and it all works now.
                Thanks to all who responded.

                Malcolm Wright

                Comment

                Working...