not able to find the mysqli.dll

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • davids58@gmail.com

    not able to find the mysqli.dll

    trying to figure out how to use a mysql database with PHP. I ran the
    following code:
    <?php
    // defines database connection data
    define('DB_HOST ', 'localhost');
    define('DB_USER ', 'ajaxuser');
    define('DB_PASS WORD', 'practical');
    define('DB_DATA BASE', 'ajax');
    // connect to the database
    $mysqli = new mysqli(DB_HOST, DB_USER, DB_PASSWORD, DB_DATABASE);
    // the SQL query to execute
    $query = 'SELECT user_id, user_name FROM users';
    //execute the query
    $result = $mysqli->query($query );
    // loop through the results
    while ($row = $result->fetch_array(MY SQLI_ASSOC))
    {
    // extract user id and name
    $user_id = $row['user_id'];
    $user_name = $row['user_name'];
    // do somthing with the data (here we output it)
    echo 'Name of user #' . $user_id . ' is ' . $user_name . '<br/>';
    }
    // close the input stream
    $result->close();
    // close the database connection
    $mysqli->close();
    ?>

    I get the following message suggesting that it can't find the
    mysqli.dll file:
    "Fatal error: Class 'mysqli' not found in
    C:\Apache\htdoc s\ajax\foundati ons\mysql\index .php on line 13"

    I have the following in php.ini:
    extension=php_m ysqli.dll

    I have php_mysqli.dll in php\ext\. I assume that this is where the
    class would be implemented. Is that correct?

    Any thoughts what the issue might be?

    TIA,
    David

  • Erwin Moller

    #2
    Re: not able to find the mysqli.dll

    davids58@gmail. com wrote:
    trying to figure out how to use a mysql database with PHP. I ran the
    following code:
    <?php
    // defines database connection data
    define('DB_HOST ', 'localhost');
    define('DB_USER ', 'ajaxuser');
    define('DB_PASS WORD', 'practical');
    define('DB_DATA BASE', 'ajax');
    // connect to the database
    $mysqli = new mysqli(DB_HOST, DB_USER, DB_PASSWORD, DB_DATABASE);
    // the SQL query to execute
    $query = 'SELECT user_id, user_name FROM users';
    //execute the query
    $result = $mysqli->query($query );
    // loop through the results
    while ($row = $result->fetch_array(MY SQLI_ASSOC))
    {
    // extract user id and name
    $user_id = $row['user_id'];
    $user_name = $row['user_name'];
    // do somthing with the data (here we output it)
    echo 'Name of user #' . $user_id . ' is ' . $user_name . '<br/>';
    }
    // close the input stream
    $result->close();
    // close the database connection
    $mysqli->close();
    ?>
    >
    I get the following message suggesting that it can't find the
    mysqli.dll file:
    "Fatal error: Class 'mysqli' not found in
    C:\Apache\htdoc s\ajax\foundati ons\mysql\index .php on line 13"
    >
    I have the following in php.ini:
    extension=php_m ysqli.dll
    >
    I have php_mysqli.dll in php\ext\. I assume that this is where the
    class would be implemented. Is that correct?
    >
    Any thoughts what the issue might be?
    Did you give readrights to the file for IUSR_<machinena me?

    If that does not help, you might have hitted incompatible versions of PHP
    with mySQL, eg a very old MySQL or PHP version.
    Read more about it here:


    Regards,
    Erwin Moller

    >
    TIA,
    David

    Comment

    • davids58@gmail.com

      #3
      Re: not able to find the mysqli.dll

      Did you give readrights to the file for IUSR_<machinena me?
      DRS: What is this? How do you do this?
      If that does not help, you might have hitted incompatible versions of PHP
      with mySQL, eg a very old MySQL or PHP version.
      Read more about it here:
      DRS: No, they're both very recent versions.

      Thanks,
      David

      Comment

      • davids58@gmail.com

        #4
        Re: not able to find the mysqli.dll

        I assume that this issue is related to another problem I'm trying to
        get some help on. Perhaps it might help identify what's wrong with the
        configuration?

        Please see


        Thanks!
        =============== =============== ===========

        Comment

        • Erwin Moller

          #5
          Re: not able to find the mysqli.dll

          davids58@gmail. com wrote:
          >Did you give readrights to the file for IUSR_<machinena me?
          DRS: What is this? How do you do this?
          rightclick the file -select properties
          -select security (or whatever W$ named that on your OS)
          -check if IUSR_<machinena meis listed there.
          If not, add with readrights.

          IUSR_<machinena meshould be replaced by the user on your machine.
          So if your server has the name blabla2, this user is called IUSR_blabla2.

          It works like this: When IIS gets a request for a certain
          file/page/whatever, it tries to open it.
          For that it need rights to read the file. Makes sense eh?
          So last piece of the puzzle: Who is IIS when it open a file? Answer: IIS
          runs as user IUSR_<machinena me>

          Does that help?
          If not come back here.

          Regards,
          Erwin Moller

          >
          >If that does not help, you might have hitted incompatible versions of PHP
          >with mySQL, eg a very old MySQL or PHP version.
          >Read more about it here:
          DRS: No, they're both very recent versions.
          >
          Thanks,
          David

          Comment

          • Sy

            #6
            Re: not able to find the mysqli.dll

            $mysqli is a function not a class.
            If you want to reuse this function then you need to change the code.

            class Mysqli

            On Oct 23, 4:18 am, david...@gmail. com wrote:
            trying to figure out how to use a mysql database with PHP. I ran the
            following code:
            <?php
            // defines database connection data
            define('DB_HOST ', 'localhost');
            define('DB_USER ', 'ajaxuser');
            define('DB_PASS WORD', 'practical');
            define('DB_DATA BASE', 'ajax');
            // connect to the database
            $mysqli = new mysqli(DB_HOST, DB_USER, DB_PASSWORD, DB_DATABASE);
            // the SQL query to execute
            $query = 'SELECT user_id, user_name FROM users';
            //execute the query
            $result = $mysqli->query($query );
            // loop through the results
            while ($row = $result->fetch_array(MY SQLI_ASSOC))
            {
            // extract user id and name
            $user_id = $row['user_id'];
            $user_name = $row['user_name'];
            // do somthing with the data (here we output it)
            echo 'Name of user #' . $user_id . ' is ' . $user_name . '<br/>';
            }
            // close the input stream
            $result->close();
            // close the database connection
            $mysqli->close();
            ?>
            >
            I get the following message suggesting that it can't find the
            mysqli.dll file:
            "Fatal error: Class 'mysqli' not found in
            C:\Apache\htdoc s\ajax\foundati ons\mysql\index .php on line 13"
            >
            I have the following in php.ini:
            extension=php_m ysqli.dll
            >
            I have php_mysqli.dll in php\ext\. I assume that this is where the
            class would be implemented. Is that correct?
            >
            Any thoughts what the issue might be?
            >
            TIA,
            David

            Comment

            • Sy

              #7
              Re: not able to find the mysqli.dll

              The issue is that you $mysqli is a function not a class. If you want
              to reuse this function then it is worth making it into a class.
              The call to $mysqli->XXXXX is a call to a class.
              Search for object orientated programing in php, or OOP in PHP. This
              will let you make the class that you are after.

              Comment

              • Andy Hassall

                #8
                Re: not able to find the mysqli.dll

                On 23 Oct 2006 11:29:32 -0700, "Sy" <simon@outdoore xplorers.comwro te:
                >$mysqli is a function not a class.
                >If you want to reuse this function then you need to change the code.
                No, the mysqli extension defines a mysqli class for working with MySQL.

                --
                Andy Hassall :: andy@andyh.co.u k :: http://www.andyh.co.uk
                http://www.andyhsoftware.co.uk/space :: disk and FTP usage analysis tool

                Comment

                • Sy

                  #9
                  Re: not able to find the mysqli.dll

                  If that is a native class to MySQL then ok (I know nothing of MySQL as
                  that isnt the database i use). However if you are calling a class from
                  another location then you need to include/require that class in your
                  code.

                  i.e.

                  include "path/to/the/file/that/has/the/class/in/it";

                  Comment

                  • Andy Hassall

                    #10
                    Re: not able to find the mysqli.dll


                    On 23 Oct 2006 11:46:52 -0700, "Sy" <simon@outdoore xplorers.comwro te:

                    [context restored]
                    On Mon, 23 Oct 2006 19:42:40 +0100, Andy Hassall <andy@andyh.co. ukwrote:
                    >
                    >No, the mysqli extension defines a mysqli class for working with MySQL.
                    >
                    >If that is a native class to MySQL then ok (I know nothing of MySQL as
                    >that isnt the database i use). However if you are calling a class from
                    >another location then you need to include/require that class in your
                    >code.
                    >
                    >i.e.
                    >
                    >include "path/to/the/file/that/has/the/class/in/it";
                    No, the mysqli ___extension___ defines a mysqli class for working with MySQL.

                    --
                    Andy Hassall :: andy@andyh.co.u k :: http://www.andyh.co.uk
                    http://www.andyhsoftware.co.uk/space :: disk and FTP usage analysis tool

                    Comment

                    • davids58@gmail.com

                      #11
                      Re: not able to find the mysqli.dll

                      Sorry to be so dense. See reponses below

                      Erwin Moller wrote:
                      rightclick the file -select properties
                      -select security (or whatever W$ named that on your OS)
                      -check if IUSR_<machinena meis listed there.
                      If not, add with readrights.
                      DRS: The windows properties view doesn't provide a 'add readrights'
                      feature. By 'machinename', I assume you mean the computer name. There
                      also is not ability to address computer name in a file's properties
                      view.
                      >
                      IUSR_<machinena meshould be replaced by the user on your machine.
                      So if your server has the name blabla2, this user is called IUSR_blabla2.
                      DRS: is the server name the same as the computer name? Are we talking
                      about the web server (apache) here?
                      >
                      It works like this: When IIS gets a request for a certain
                      file/page/whatever, it tries to open it.
                      For that it need rights to read the file. Makes sense eh?
                      So last piece of the puzzle: Who is IIS when it open a file? Answer: IIS
                      runs as user IUSR_<machinena me>
                      DRS: As I mention above, I'm using Apache. FYI, Apache is serving up
                      pages just fine. It's the php->mysql interface that's the problem. It's
                      not clear to me that apache could/should know anything about mysql.

                      FYI, I've checked out phpMyAdmin's graphical setup facility but I
                      really don't know what I need to do. I have selected mysqli as the php
                      extension to use but beyond that, I'm not sure what to do.

                      Here are a couple of snapshots of the setup utility:

                      1. Initial screen:

                      2. Configuration overview:


                      Any additional help would be greatly appreciated!

                      David

                      Comment

                      • Erwin Moller

                        #12
                        Re: not able to find the mysqli.dll

                        davids58@gmail. com wrote:
                        Sorry to be so dense. See reponses below
                        >
                        Erwin Moller wrote:
                        >
                        >rightclick the file -select properties
                        >-select security (or whatever W$ named that on your OS)
                        >-check if IUSR_<machinena meis listed there.
                        >If not, add with readrights.
                        >
                        DRS: The windows properties view doesn't provide a 'add readrights'
                        feature.
                        No, I didn't claim a button exists with that name...
                        Which OS are you on?
                        Does it have a security-tab if you view the properties of the dll?
                        If you click that securitytab, what do you see?



                        By 'machinename', I assume you mean the computer name. There
                        also is not ability to address computer name in a file's properties
                        view.
                        Yes, there is. Unless you are running Windows 95 or something.

                        By the way, if you are using apache, you shouldn't add IUSR_<Machinena me>
                        but find out wich user runs apache first, and give that user readrights.

                        I don't know by heart since I only run Apache under *nix, and only IIS on
                        W$.
                        It should be all in the documentation.
                        Did you read any documentation?
                        >>
                        >IUSR_<machinen ameshould be replaced by the user on your machine.
                        >So if your server has the name blabla2, this user is called IUSR_blabla2.
                        >
                        DRS: is the server name the same as the computer name? Are we talking
                        about the web server (apache) here?
                        >>
                        >It works like this: When IIS gets a request for a certain
                        >file/page/whatever, it tries to open it.
                        >For that it need rights to read the file. Makes sense eh?
                        >So last piece of the puzzle: Who is IIS when it open a file? Answer: IIS
                        >runs as user IUSR_<machinena me>
                        >
                        DRS: As I mention above, I'm using Apache. FYI, Apache is serving up
                        pages just fine. It's the php->mysql interface that's the problem. It's
                        not clear to me that apache could/should know anything about mysql.
                        >
                        FYI, I've checked out phpMyAdmin's graphical setup facility but I
                        really don't know what I need to do. I have selected mysqli as the php
                        extension to use but beyond that, I'm not sure what to do.
                        >
                        Here are a couple of snapshots of the setup utility:
                        >
                        1. Initial screen:

                        2. Configuration overview:
                        http://www.drschwartz.net/personal/...min_setup_2.jpg
                        I couldn't reach those oddly named pages.

                        Regards,
                        Erwin Moller
                        >
                        Any additional help would be greatly appreciated!
                        >
                        David

                        Comment

                        • davids58@gmail.com

                          #13
                          Re: not able to find the mysqli.dll

                          No, I didn't claim a button exists with that name...
                          Which OS are you on?
                          Does it have a security-tab if you view the properties of the dll?
                          If you click that securitytab, what do you see?
                          DRS: No security tab. I'm running Windows XP Home SP2. The dll's
                          properties view only has 4 tabs: General, Version, Virus Property
                          (added by my virus program, I'd guess), and Summary. None let me set
                          any type of readrights for the file.
                          >
                          >
                          By 'machinename', I assume you mean the computer name. There
                          also is not ability to address computer name in a file's properties
                          view.
                          >
                          Yes, there is. Unless you are running Windows 95 or something.
                          DRS: Not that I can see.
                          >
                          By the way, if you are using apache, you shouldn't add IUSR_<Machinena me>
                          but find out wich user runs apache first, and give that user readrights.
                          >
                          DRS: What does 'which user runs apache first' mean? Is that a *nix
                          issue?
                          I don't know by heart since I only run Apache under *nix, and only IIS on
                          W$.
                          It should be all in the documentation.
                          Did you read any documentation?
                          >
                          DRS: Not much; I thought I might get a quick answer here.
                          >
                          >
                          I couldn't reach those oddly named pages.
                          >
                          DRS: Sorry about that! The tool collapsed the url. Here's a tinyurl of
                          the same pages:



                          FYI, I've installed EasyPHP and am able to get data through PHP.
                          However, I need to use the OO constructs in PHP 5.0. Is it possible to
                          upgrade EasyPHP to 5.0?

                          Thanks for your help,
                          David

                          Comment

                          Working...