I am trying to set up a server with mysql5 and php5. I used the binaries provided on mysql.com to install mysql. For php I compilied it once with --with-mysql but then found out that --with-mysql doens't wotk for mysql5. So I have gone back to recomplie php with --with-mysqli. But try as I might I can't get php to configure. I keep getting "

checking for MySQLi support... yes
checking whether to enable embedded MySQLi support... no
checking for mysql_set_server_option in -lmysqlclient... no
configure: error: wrong mysql library version or lib not found. Check config.log for more information.
"
My config command is:
./configure --with-apxs2=/usr/local/apache2/bin/apxs --without-mysql --with-mysqli=/usr/local/mysql/bin/mysql_config --with-zlib --with-curl --with-gd --with-libxml-dir=/usr/lib

I had php previously compile with --with-mysql.

Any help would be greatly appreciated.

    Hi,

    please post the file config.log as attachment.
    You might need to add the mysql lib path to the environment variable LD_LIBRARY_PATH. Which OS is installed on your server ?

    Thomas

      THanks for the reply. However, now (as I look to me left at the console) I see the ./configure just worked!
      What I did was follow these directions:

      I was running into some random issues using the myqli extension with MySQL 5 on Mac OS X.

      I discovered that when I compiled php 5 with the --with-mysqli flag, it was building php with the pre-installed MySQL 4 client libraries.

      Heres how it fixed it to build php with the correct MySQL client libraries.


      I had installed the binary version of MySQL 5 from MySQL AB. It installs everything in the default location /usr/local/mysql, which is fine. The MySQL version that comes with OS X ( v.4.x, depends on your OS X version ) installs the mysql_config help utility at /usr/bin/mysql_config. When php configs, it uses that one by default, inheritently using the wrong MySQL client libs.

      No problem I thought, I just changed the --with-mysqli flag to --with-mysqli=/usr/local/mysql/bin/mysql_config ( or sudo find / -name mysql_config to find yours ). Nope, php throws a build error because it can't find the matching libraries. Hmmm...

      So i tested /usr/local/mysql/bin/mysql_config --version, and I am shown my most current MySQL install. The problem is that the binary editions for OS X DO NOT include the shared libs ( libmysqlclient.dylib ). Oh no, I did not want to compile MySQL myself, not because I don't know how, but because MySQL AB does not recommend it, and for good reasons. Trust me, I've found out the hard way.

      So what do you do? Download the source version of MySQL 5 that matches my binary version.

      Configure MySQL:

      ./configure --enable-shared ( it's listed as ON as default, but I want to be sure )

      Build MySQL:

      make ( requires Developer Tools, but you knew that )

      DO NOT make install !!! I repeat, DO NOT make install unless you really wish to overwrite your binary verions, which is not a good idea. ( You can configure MySQL with the --without-server flag, but I want to be certain I don't mess up )

      Ok, almost done. Go to the lib directory in your MySQL build location and go to the invisible directory, .libs . There you will find your shared libraries, namely libmysqlclient.15.0.0.dylib.

      Copy this to your /usr/local/mysql/lib directory. Now do the following from the lib directory:

      ln -s libmysqlclient.15.0.0.dylib libmysqlclient.15.dylib
      ln -s libmysqlclient.15.0.0.dylib libmysqlclient.dylib
      mkdir mysql
      cd mysql
      ln -s ../libmysqlclient.15.0.0.dylib libmysqlclient.15.0.0.dylib
      ln -s ../libmysqlclient.15.0.0.dylib libmysqlclient.15.dylib
      ln -s ../libmysqlclient.15.0.0.dylib libmysqlclient.dylib

      Now you can build your php with the correct library. After you build, check your phpinfo(); to validate the client version under the mysqli section. When I restarted Apache, it originally couldn't find my libraries, thus the /usr/local/mysql/lib/mysql directory.

      Hope this helped.
      "

      From a post at php.net

      It has to do with the dynamic libraries.
      I hope this helps anybody else with this problem.

        Write a Reply...