MySQL5 & PHP5

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Sarah Tanembaum

    MySQL5 & PHP5

    Though I installed MySQL5 and PHP5, how come my phpinfo() shows as follow:

    MySQL Support enabled
    Active Persistent Links 0
    Active Links 0
    Client API version 3.23.57 <<<<<<<<<<<<< <<

    Instead of saying 3.23.57, shouldn't it show 5.xx.xx? Or, did I do
    something wrong?

    Thanks
  • Peter

    #2
    Re: MySQL5 &amp; PHP5

    You need to look at the 'configure command' in phpinfo() and use it to
    recompile php.
    You have to install the mysql development header files and recompile Php
    with the --with-mysql configure option.

    At the moment your version of PHP is compiled with support for mysql3.23


    Sarah Tanembaum wrote:[color=blue]
    > Though I installed MySQL5 and PHP5, how come my phpinfo() shows as follow:
    >
    > MySQL Support enabled
    > Active Persistent Links 0
    > Active Links 0
    > Client API version 3.23.57 <<<<<<<<<<<<< <<
    >
    > Instead of saying 3.23.57, shouldn't it show 5.xx.xx? Or, did I do
    > something wrong?
    >
    > Thanks[/color]

    Comment

    • Sarah Tanembaum

      #3
      Re: MySQL5 &amp; PHP5

      Peter wrote:[color=blue]
      > You need to look at the 'configure command' in phpinfo() and use it to
      > recompile php.
      > You have to install the mysql development header files and recompile Php
      > with the --with-mysql configure option.
      >
      > At the moment your version of PHP is compiled with support for mysql3.23
      >
      >
      > Sarah Tanembaum wrote:
      >[color=green]
      >> Though I installed MySQL5 and PHP5, how come my phpinfo() shows as
      >> follow:
      >>
      >> MySQL Support enabled
      >> Active Persistent Links 0
      >> Active Links 0
      >> Client API version 3.23.57 <<<<<<<<<<<<< <<
      >>
      >> Instead of saying 3.23.57, shouldn't it show 5.xx.xx? Or, did I do
      >> something wrong?
      >>
      >> Thanks[/color][/color]

      Is there a reason why they do not compile them with the latest release?
      Even for beta release?

      I got the binary from PHP central repository, is there any other
      reliable place I can download binaries for mswin32?

      PS: I'm running on windows.

      Thanks

      Comment

      • Tristan Tarrant

        #4
        Re: MySQL5 &amp; PHP5

        >>> Instead of saying 3.23.57, shouldn't it show 5.xx.xx? Or, did I do[color=blue][color=green][color=darkred]
        >>> something wrong?
        >>>
        >>> Thanks[/color][/color]
        >
        > Is there a reason why they do not compile them with the latest release?
        > Even for beta release?[/color]

        For the widely available binaries they compile against the lowest common
        denominator: MySQL 3.x.
        It is up to deployers to recompile it for a specific version. Also MySQL
        5.x is not even close to stable, and MySQL 4.1 stable has only recently
        appeared.


        Tristan

        Comment

        • Andy Hassall

          #5
          Re: MySQL5 &amp; PHP5

          On Thu, 02 Dec 2004 13:01:55 -0500, Sarah Tanembaum <sarahtanembaum @yahoo.com>
          wrote:
          [color=blue]
          >Though I installed MySQL5 and PHP5, how come my phpinfo() shows as follow:
          >
          >MySQL Support enabled
          >Active Persistent Links 0
          >Active Links 0
          >Client API version 3.23.57 <<<<<<<<<<<<< <<
          >
          >Instead of saying 3.23.57, shouldn't it show 5.xx.xx? Or, did I do
          >something wrong?[/color]

          You're apparently using the MySQL client library bundled with the Windows zip
          distribution, rather than one from your MySQL installation.

          --
          Andy Hassall / <andy@andyh.co. uk> / <http://www.andyh.co.uk >
          <http://www.andyhsoftwa re.co.uk/space> Space: disk usage analysis tool

          Comment

          • Sarah Tanembaum

            #6
            Re: MySQL5 &amp; PHP5

            Andy Hassall wrote:[color=blue]
            > On Thu, 02 Dec 2004 13:01:55 -0500, Sarah Tanembaum <sarahtanembaum @yahoo.com>
            > wrote:
            >
            >[color=green]
            >>Though I installed MySQL5 and PHP5, how come my phpinfo() shows as follow:
            >>
            >>MySQL Support enabled
            >>Active Persistent Links 0
            >>Active Links 0
            >>Client API version 3.23.57 <<<<<<<<<<<<< <<
            >>
            >>Instead of saying 3.23.57, shouldn't it show 5.xx.xx? Or, did I do
            >>something wrong?[/color]
            >
            >
            > You're apparently using the MySQL client library bundled with the Windows zip
            > distribution, rather than one from your MySQL installation.
            >[/color]
            Hi Andy, isn't that the only Windows binaries distribution available
            from MySQL? Or perhaps there are other Windows Binaries distribution
            that I'm not aware of?

            At any case, I presume that the later version will be much better
            organize/design for OR(Object-Relational) or OO(Object Oriented)
            programming, plus it will take advantage of additional features in 4.1
            as well as 5.x. Thanks

            Comment

            • Tony Reed

              #7
              Re: MySQL5 &amp; PHP5

              On Thu, 02 Dec 2004 14:39:46 -0500
              Sarah Tanembaum <sarahtanembaum @yahoo.com> wrote:

              :Hi Andy, isn't that the only Windows binaries distribution available
              :from MySQL? Or perhaps there are other Windows Binaries distribution
              :that I'm not aware of?
              :
              :At any case, I presume that the later version will be much better
              :organize/design for OR(Object-Relational) or OO(Object Oriented)
              :programming, plus it will take advantage of additional features in 4.1
              :as well as 5.x. Thanks

              As with all things Windows, it's a bit obscure. For PHP5, I get the
              same listing as you do (3.23.57) with php_info(), but if I use mysql
              from a "command prompt," then

              mysql> \s

              tells me "Server Version 4.1.7" so I dunno. This is the mysqld that
              Apache interacts with through PHP.

              --
              Tony Reed
              <trljc@altern.o rg>

              Comment

              • Andy Hassall

                #8
                Re: MySQL5 &amp; PHP5

                On 02 Dec 2004 16:02:54 -0500, Tony Reed <trljc@altern.o rg> wrote:
                [color=blue]
                >On Thu, 02 Dec 2004 14:39:46 -0500
                > Sarah Tanembaum <sarahtanembaum @yahoo.com> wrote:
                >
                >:Hi Andy, isn't that the only Windows binaries distribution available
                >:from MySQL? Or perhaps there are other Windows Binaries distribution
                >:that I'm not aware of?
                >:
                >:At any case, I presume that the later version will be much better
                >:organize/design for OR(Object-Relational) or OO(Object Oriented)
                >:programming , plus it will take advantage of additional features in 4.1
                >:as well as 5.x. Thanks
                >
                >As with all things Windows, it's a bit obscure. For PHP5, I get the
                >same listing as you do (3.23.57) with php_info(), but if I use mysql
                >from a "command prompt," then
                >
                >mysql> \s
                >
                >tells me "Server Version 4.1.7" so I dunno. This is the mysqld that
                >Apache interacts with through PHP.[/color]

                That's because that's the server version, which has nothing to do with the
                client version. Further, the fact that you're running 'mysql' means that's come
                from a MySQL install; PHP only comes with a client DLL, not the mysql CLI
                program.

                --
                Andy Hassall / <andy@andyh.co. uk> / <http://www.andyh.co.uk >
                <http://www.andyhsoftwa re.co.uk/space> Space: disk usage analysis tool

                Comment

                • Andy Hassall

                  #9
                  Re: MySQL5 &amp; PHP5

                  On Thu, 02 Dec 2004 14:39:46 -0500, Sarah Tanembaum <sarahtanembaum @yahoo.com>
                  wrote:
                  [color=blue]
                  >Andy Hassall wrote:[color=green]
                  >> On Thu, 02 Dec 2004 13:01:55 -0500, Sarah Tanembaum <sarahtanembaum @yahoo.com>
                  >> wrote:
                  >>
                  >>[color=darkred]
                  >>>Though I installed MySQL5 and PHP5, how come my phpinfo() shows as follow:
                  >>>
                  >>>MySQL Support enabled
                  >>>Active Persistent Links 0
                  >>>Active Links 0
                  >>>Client API version 3.23.57 <<<<<<<<<<<<< <<
                  >>>
                  >>>Instead of saying 3.23.57, shouldn't it show 5.xx.xx? Or, did I do
                  >>>something wrong?[/color]
                  >>
                  >> You're apparently using the MySQL client library bundled with the Windows zip
                  >> distribution, rather than one from your MySQL installation.[/color]
                  >
                  >Hi Andy, isn't that the only Windows binaries distribution available
                  >from MySQL?[/color]

                  You're using the MySQL library shipped with PHP, so it's not "from MySQL".

                  If you set your PATH appropriately and/or got rid of the libmySQL.dll in the
                  PHP directories, so instead it picks up libmysql.dll from your MySQL
                  directories, then you'd (probably) get a different version showing up.
                  [color=blue]
                  >Or perhaps there are other Windows Binaries distribution
                  >that I'm not aware of?[/color]

                  There's a Windows binary distribution of PHP, which includes an old client
                  library.

                  There's a Windows binary distribution of MySQL, which includes a client
                  library of whichever version you downloaded.
                  [color=blue]
                  >At any case, I presume that the later version will be much better
                  >organize/design for OR(Object-Relational) or OO(Object Oriented)
                  >programming, plus it will take advantage of additional features in 4.1
                  >as well as 5.x. Thanks[/color]

                  No, changing your MySQL client will have little or no effect on the PHP mysql
                  extension. However, PHP5 has the mysqli extension for use with 4.1 or later.

                  As to whether it takes advantage of any new features - check the docs. mysqli
                  supposedly supports prepared statements, at least.

                  Not sure why you'd want to use MySQL 5 at this stage though, since it's only
                  beta. Stick to 4.1 at the latest, unless you're being very experimental.

                  --
                  Andy Hassall / <andy@andyh.co. uk> / <http://www.andyh.co.uk >
                  <http://www.andyhsoftwa re.co.uk/space> Space: disk usage analysis tool

                  Comment

                  • Sarah Tanembaum

                    #10
                    Re: MySQL5 &amp; PHP5

                    Andy Hassall wrote:[color=blue]
                    > On Thu, 02 Dec 2004 14:39:46 -0500, Sarah Tanembaum <sarahtanembaum @yahoo.com>
                    > wrote:
                    >
                    >[color=green]
                    >>Andy Hassall wrote:
                    >>[color=darkred]
                    >>>On Thu, 02 Dec 2004 13:01:55 -0500, Sarah Tanembaum <sarahtanembaum @yahoo.com>
                    >>>wrote:
                    >>>
                    >>>
                    >>>
                    >>>>Though I installed MySQL5 and PHP5, how come my phpinfo() shows as follow:
                    >>>>
                    >>>>MySQL Support enabled
                    >>>>Active Persistent Links 0
                    >>>>Active Links 0
                    >>>>Client API version 3.23.57 <<<<<<<<<<<<< <<
                    >>>>
                    >>>>Instead of saying 3.23.57, shouldn't it show 5.xx.xx? Or, did I do
                    >>>>something wrong?
                    >>>
                    >>> You're apparently using the MySQL client library bundled with the Windows zip
                    >>>distribution , rather than one from your MySQL installation.[/color]
                    >>
                    >>Hi Andy, isn't that the only Windows binaries distribution available[/color]
                    >[color=green]
                    >>from MySQL?[/color]
                    >
                    > You're using the MySQL library shipped with PHP, so it's not "from MySQL".
                    >
                    > If you set your PATH appropriately and/or got rid of the libmySQL.dll in the
                    > PHP directories, so instead it picks up libmysql.dll from your MySQL
                    > directories, then you'd (probably) get a different version showing up.
                    >
                    >[color=green]
                    >>Or perhaps there are other Windows Binaries distribution
                    >>that I'm not aware of?[/color]
                    >
                    >
                    > There's a Windows binary distribution of PHP, which includes an old client
                    > library.
                    >
                    > There's a Windows binary distribution of MySQL, which includes a client
                    > library of whichever version you downloaded.
                    >
                    >[color=green]
                    >>At any case, I presume that the later version will be much better
                    >>organize/design for OR(Object-Relational) or OO(Object Oriented)
                    >>programming , plus it will take advantage of additional features in 4.1
                    >>as well as 5.x. Thanks[/color]
                    >
                    >
                    > No, changing your MySQL client will have little or no effect on the PHP mysql
                    > extension. However, PHP5 has the mysqli extension for use with 4.1 or later.
                    >
                    > As to whether it takes advantage of any new features - check the docs. mysqli
                    > supposedly supports prepared statements, at least.
                    >
                    > Not sure why you'd want to use MySQL 5 at this stage though, since it's only
                    > beta. Stick to 4.1 at the latest, unless you're being very experimental.
                    >[/color]

                    Hi Andy, I did replace c:\php5\libmysq l.dll with
                    c:\mysql5\lib\o pt\libmysql.dll , restart the apache2, and check again.
                    Unfortunately, nothing change, it still say 3.23.57.

                    Perhaps I need newer c:\php5\ext\php _mysql.dll for mysql5. Where can I
                    get the binaries for php5/mysql5 dlls?

                    How do you use mysqli anyway? Is it not compatible with the mysql version?

                    Thanks

                    Comment

                    • Tony Reed

                      #11
                      Re: MySQL5 &amp; PHP5

                      On Thu, 02 Dec 2004 23:03:18 +0000
                      Andy Hassall <andy@andyh.co. uk> wrote:

                      :
                      : If you set your PATH appropriately and/or got rid of the libmySQL.dll in the
                      :PHP directories, so instead it picks up libmysql.dll from your MySQL
                      :directories, then you'd (probably) get a different version showing up.
                      :

                      I tried that just now, it doesn't work, you get errors about missing
                      commands (I think that's what it said) from Apache when you try to
                      restart it. The libmysql.dll in the PHP distribution is needed. It
                      somehow "links" to the "main" libmysql.dll in the MySQL distribution
                      (which is much bigger). What I think is that mod_mysql.dll is what
                      Apache is using as a "reference, " Note: all the words in quotes, I know
                      that they're not the right words.

                      I (obviously) haven't tried out all the features of MySQL against what
                      Apache's PHP module knows about it, but the minor stuff I _do_ use
                      works just fine.

                      Hmm. I'll boot up my OS X system and see what's what in there once the
                      trouble's finished with the Mac; that's got the same versions of
                      Apache/PHP/MySQL as my NT 4 system, except that I compiled them all.
                      Of course, they don't call them *.dll in Unix, I think that the *.so
                      files are the same thing.


                      --
                      Tony Reed
                      <trljc@altern.o rg>

                      Comment

                      • Andy Hassall

                        #12
                        Re: MySQL5 &amp; PHP5

                        On 02 Dec 2004 20:39:05 -0500, Tony Reed <trljc@altern.o rg> wrote:
                        [color=blue]
                        >On Thu, 02 Dec 2004 23:03:18 +0000
                        > Andy Hassall <andy@andyh.co. uk> wrote:
                        >
                        >:
                        >: If you set your PATH appropriately and/or got rid of the libmySQL.dll in the
                        >:PHP directories, so instead it picks up libmysql.dll from your MySQL
                        >:directories , then you'd (probably) get a different version showing up.
                        >:
                        >
                        >I tried that just now, it doesn't work, you get errors about missing
                        >commands (I think that's what it said) from Apache when you try to
                        >restart it. The libmysql.dll in the PHP distribution is needed. It
                        >somehow "links" to the "main" libmysql.dll in the MySQL distribution
                        >(which is much bigger). What I think is that mod_mysql.dll is what
                        >Apache is using as a "reference, " Note: all the words in quotes, I know
                        >that they're not the right words.
                        >
                        >I (obviously) haven't tried out all the features of MySQL against what
                        >Apache's PHP module knows about it, but the minor stuff I _do_ use
                        >works just fine.[/color]

                        Lots of confusion here; doesn't help that the PHP documentation is wrong and
                        misleading. http://uk.php.net/mysql says:

                        "In Windows, there is no DLL, it's simply built into PHP 4." (No, it isn't,
                        it's linked to the bundled MySQL 3.2 client library DLL)

                        "In PHP 5, MySQL is no longer enabled by default, nor is the MySQL library
                        bundled with PHP." (It is on Windows, though)

                        PHP's MySQL extension module isn't specific to Apache, in fact Apache doesn't
                        really come into the picture at all here.

                        OK... PHP's php_mysql.dll is linked to libmysql.dll.

                        libmysql.dll bundled with PHP is a full 3.2 client library. It is not linked
                        to a full MySQL installation elsewhere. Download Dependency Walker and have a
                        look if you want.

                        Having now tried replacing the DLL on my local system, it indeed doesn't work,
                        as you point out, with 4.0 or 4.1, as ext/php_mysql.dll tries to import
                        functions from the libmysql.dll that the 4.0 and 4.1 client library apparently
                        doesn't export - the first one it picks up is mysql_drop_db.

                        According to the MySQL manual this is a deprecated function:



                        It doesn't mention that not only is it deprecated, it in fact apparently no
                        longer exists. Presumably if you compiled from source (as is usual on Unix),
                        it's got different paths in the PHP php_mysql.dll code based on the MySQL
                        version.

                        Looking at the source code, this is exactly the case:

                        (ext/mysql/php_mysql.c:112 )

                        #if MYSQL_VERSION_I D < 40000
                        PHP_FE(mysql_cr eate_db, NULL)
                        PHP_FE(mysql_dr op_db, NULL)
                        #endif

                        So if you want to use a client library of a later version than the 3.2 library
                        bundled with the Windows binary distribution, it appears you either have to
                        compile it yourself, or find someone else who has done so and nab their copy of
                        php_mysql.dll.

                        --
                        Andy Hassall / <andy@andyh.co. uk> / <http://www.andyh.co.uk >
                        <http://www.andyhsoftwa re.co.uk/space> Space: disk usage analysis tool

                        Comment

                        • Andy Hassall

                          #13
                          Re: MySQL5 &amp; PHP5

                          On Thu, 02 Dec 2004 18:58:24 -0500, Sarah Tanembaum <sarahtanembaum @yahoo.com>
                          wrote:
                          [color=blue]
                          >Hi Andy, I did replace c:\php5\libmysq l.dll with
                          >c:\mysql5\lib\ opt\libmysql.dl l, restart the apache2, and check again.
                          >Unfortunatel y, nothing change, it still say 3.23.57.[/color]

                          See my other message in reply to Tony Reed - unless you recompile PHP, you
                          have to stick with the bundled 3.23.57 library.
                          [color=blue]
                          >Perhaps I need newer c:\php5\ext\php _mysql.dll for mysql5. Where can I
                          >get the binaries for php5/mysql5 dlls?[/color]

                          Not so much newer, but just recompiled against a later MySQL version. Maybe
                          you could search Google.

                          Having said all this, there's still the question whether running with a
                          3.23.57 client actually makes any difference - you won't get any new features
                          with a new client library. Maybe there's bug fixes or performance issues. Don't
                          know.
                          [color=blue]
                          >How do you use mysqli anyway? Is it not compatible with the mysql version?[/color]

                          See http://php.net/mysqli. The mysql extension doesn't support any new
                          features past 3.2. If you want to use some of the new MySQL features, you use
                          mysqli.

                          --
                          Andy Hassall / <andy@andyh.co. uk> / <http://www.andyh.co.uk >
                          <http://www.andyhsoftwa re.co.uk/space> Space: disk usage analysis tool

                          Comment

                          Working...