Re: Yet another MySQL+PHP5 issue

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 




I hit the same problem with my recent (first) install of PHP(5) with Apache(2) and MySQL 4.0.18.
Looking at the PHP list archives it is clearly giving quite a few people problems. I spent some time
experimenting with this to get it working, and came to some interesting conclusions, which don't
always agree with what the docs say. Here's what I found-


* The libmySQL.dll (note capitalisation) that comes with the mysql install will NOT work with
Apache/PHP, at least with the versions I have. Only the libmysql.dll shipped with the PHP
install works.


I don't know what the reason is, it could be a version mismatch or maybe mysql and PHP are
built using different compilers, but it's a problem.


* I think if the lib shipped with mysql is first in your search path (but see below), it prevents the
PHP-shipped one being seen, and prevents the module loading.


* The PHP install docs say the dlls are searched for using the PATH from the environment, but
I found this did not work reliably. For example I have both "C:\WINDOWS" and
"C:\WINDOWS\system32" in my PATH, but putting the PHP-sourced libmysql.dll in the
WINDOWS directory did not work, it had to be in the system32 subdirectory.


* Bizarrely, even putting the libmysql.dll in the same directory as php_mysql.dll fails. Even
Though Apache finds php_mysql ok, this in turn fails to find libmysql.


Nett of all this, is (for me), to get a working system I have:

1) In Apache httpd.conf:

   #
   # PHP 5 Support.
   #
   LoadModule php5_module "C:/Program Files/PHP/php5apache2.dll"
   AddType application/x-httpd-php .php

2) System PATH:

C:\WINDOWS\system32;C:\WINDOWS;C:\Program Files\MySQL\bin;C:\Program Files\PHP

3) In C:\WINDOWS\php.ini:

   extension_dir = "C:\Program Files\PHP\ext"

   extension=php_mysql.dll

4)  In C:\WINDOWS\system32:

    A copy of the libmysql.dll taken from the PHP install directory.


Overall this is more than a bit obscure and error-prone, and it's not a very elegant solution. My initial
impression is that Apache 2 is still fairly "green", for instance on my machine after a couple of basic
edits of the httpd.conf file I now find the server will crash if I use the Stop or Restart functions of the
Apache Service Monitor.


Lets hope this gets cleaned up as the software matures.

Good luck.

Regards: Colin

   Steven James Samuel Stapleton <stapleton@xxxxxxxxxxxxxxxxxx> wrote:

   Date:
   Fri, 29 Oct 2004 22:46:11 -0400

   To:
   php-windows@xxxxxxxxxxxxx


I am running PHP 5.0.2 and MySQL 4.0.21-nt

   the install directory (C:\WBP\PHP\) is in the path. The MySQL dir is
   not in the path.

   I am  attempting to use the PHP shell/command line feature (rather
   than web server), however I get this result:

   -----------------------------------------------------------------
   C:\> php -v
   PHP Warning: PHP Startup: Unable to load dyanamic library
   './php_mysql.dll' - The specified module could not be found.
   -----------------------------------------------------------------

   This occures with libmysql.dll in either the php dir, %WINDIR% and
   %WINDIR%\system32.

   If I place it in any of these spots and rename it php_mysql.dll, I
   get this error:

   -----------------------------------------------------------------
   PHP Warning: PHP Startup: Invalid library (maybe not a PHP library)
   'php_mysql.dll'  in Unknown on line 0
   -----------------------------------------------------------------

   Someone said that this file does not work for MySQL 4.0.21, is that
   the cause of this problem (or set of problems) or should I look
   further? I'm really stumped here.


Thank you, -Jim Stapleton



[Index of Archives]     [PHP Home]     [PHP Users]     [PHP Database Programming]     [PHP Install]     [Kernel Newbies]     [Yosemite Forum]     [PHP Books]

  Powered by Linux