Getting Started

This section explains how to install the improved MySQL library and the basics of migrating existing code to the new functions.

Installing the Library

This section discusses installation on only Unix platforms. We assume you have followed our installation instructions in Appendix A through Appendix C, and that you have installed MySQL 4.1, PHP, and Apache and now want to enable the new library. We also assume that you've kept the source code for the components, and stored it in the subdirectories of /usr/local/src/ that are recommended in Appendix A through Appendix C.

To configure the improved MySQL library, you need to reconfigure, recompile, and reinstall PHP. You also need to restart your Apache 2 server. To do this, follow these steps:

  1. Log in as the Unix root user.

  2. Change directory to your PHP source directory location using:

    %cd /usr/local/src/php-
                         version_number

    For example, if the version is PHP 5.0.0, type:

    %cd /usr/local/src/php-5.0.0
  3. Configure the PHP installation by running the configure script. Add improved MySQL support and disable regular MySQL support. This step assumes that MySQL 4.1 has been installed previously in the directory /usr/local/mysql and that Apache 2 has been installed in /usr/local/apache2:

    %./configure --with-apxs2=/usr/local/apache2/bin/apxs \
                           --without-mysql --with-mysqli=/usr/local/mysql/bin/mysql_config

    If your configure script complains, then try removing mysql_config from the second line:

    %./configure --with-apxs2=/usr/local/apache2/bin/apxs ...

Get Web Database Applications with PHP and MySQL, 2nd Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.