mugshot, larkspur


Gopal Venkatesan's Former Journal

My writings on free/open source software and other technologies

Previous Entry Add to Memories Share Next Entry
PHP 5.3.4 and MySQL 5.5.8 GA (libmysql)
mugshot, larkspur

This content has been updated and moved to a new place.

As you are probably aware, PHP 5.3.4 does not compile with MySQL 5.5 GA. The details can be seen in MySQL bug queue. Basically, the problem boils down to incorrect installation of MySQL headers. MySQL 5.5 build system does not install the headers under the include-prefix/mysql directly but instead installs under the include-prefix directory itself. So, when the PHP build system looks for the MySQL headers, it cannot find <mysql/psi/mysql_thread.h> and so forth.

What is the fix?

The MySQL dev team has committed patches to fix this issue in MySQL which is due to go out in the next release. If you are impatient for the next release, go ahead and grab the patches and apply them onto the MySQL (5.5.8) source tree and recompile MySQL. You need to download the patch 1 first and apply it, followed by patch 2. The following are the basic steps to be followed:

  1. If MySQL server is running, bring it down. shell$ sudo /path/to/mysql/bin/mysqladmin -u root shutdown
  2. Extract the source tarball (5.5.8) and apply the patches
  3. Configure and build the system.
    1. MySQL 5.5 and above uses CMake instead of the traditional autotools.
    2. shell$ cmake -DDEFAULT_CHARSET=utf8 -DDEFAULT_COLLATION=utf8_unicode_ci -LH .
    3. shell$ make
    4. shell$ sudo make install
  4. Start the MySQL server. shell$ sudo /path/to/mysql/bin/mysqld_safe --user=mysql &

Configuring PHP

Now that we have MySQL "fixed", we can configure PHP with the traditional configure --with-mysqli=/path/to/mysql/bin/mysql_config followed by make && sudo make install and you're good to go!