Apache2.2 + PHP5.2 + mysql/mysqli/pdo_mysql from sketch on Debian sid HOWTO

This simple HOWTO will guide you about how to setup Apache2.2 + PHP5.2 + mysql/mysqli/pdo_mysql from sketch. Compile all package from tarball can give you the maximum flexibility of functionality, e.g. you can enable both mysql/mysqli/pgsql/oci8/pdo_mysql/pdo_pgsql/pdo_oci within single installation.

Before start, I will assume you have Debian sid and MySQL5 installed correctly, which will not detail within this document. In case of Debian, MySQL5 installation is just as simple as a single command:

apt-get install mysql-server-5.0 mysql-client-5.0 mysql-common

This HOWTO is highly similar as my other article which target for install Apache2.2 + PHP5.2 + OCI8/PDO_OCI from sketch on Debian sid. Therefore some duplicated section will directly refer to there, and only mention those different in case for MySQL in here.

Common procedures

Most preparation procedures are shared as mentioned in introduction, at least up to PHP5 install. So you will need to complete:

Install PHP5.2 (MySQL version)

Again, most procedures are share so first refer to here for more information.

In case of MySQL, you will need to add the following configuration parameters for activating mysql, mysqli and pdo_mysql support:

  --with-mysql=/usr/share/mysql \
  --with-mysqli=/usr/bin/mysql_config \
  --with-pdo-mysql=/usr/bin/mysql_config \
  --with-mysql-sock=/var/run/mysqld/mysqld.sock \

So the complete PHP5.2 configuration command with mysql + mysqli + pdo_mysql should be:

./configure \
  --with-apxs2=/usr/local/apache2/bin/apxs \
  --with-config-file-path=/usr/local/apache2/conf \
  --enable-sigchild \
  --enable-bcmath \
  --with-bz2 \
  --enable-calendar \
  --with-curl \
  --enable-dba \
  --enable-exif \
  --enable-ftp \
  --with-gd \
  --with-gettext \
  --with-imap \
  --with-imap-ssl \
  --with-kerberos \
  --enable-mbstring \
  --with-mcrypt \
  --with-mime-magic=/usr/share/file/magic.mime \
  --with-openssl \
  --enable-shmop \
  --enable-soap \
  --enable-sockets \
  --enable-sqlite-utf8 \
  --enable-sysvmsg \
  --enable-wddx \
  --enable-zip \
  --with-zlib \
  --with-mysql=/usr/share/mysql \
  --with-mysqli=/usr/bin/mysql_config \
  --with-pdo-mysql=/usr/bin/mysql_config \
  --with-mysql-sock=/var/run/mysqld/mysqld.sock \

Just follow the rest of standard procedures :-)

Install phpMyAdmin

Usually I would like to install phpMyAdmin manually. First of all, you will need to obtain the all-languages.tar.gz from official homepage.

Next, extra the download file (e.g. phpMyAdmin-2.11.8-rc1-all-languages.tar.gz) and place it into suitable location:

tar zxvf phpMyAdmin-2.11.8-rc1-all-languages.tar.gz
mv phpMyAdmin-2.11.8-rc1-all-languages /var/www
cd /var/www
ln -s phpMyAdmin-2.11.8-rc1-all-languages phpmyadmin

Now we can follow the official installation guideline as mentioned in Documentation.txt. E.g. if configure with Setup Script, you will need to:

cd /var/www/phpmyadmin
mkdir config
cp config.sample.inc.php config/config.inc.php
chmod -Rf 777 config

Access your phpMyAdmin Setup Script with browser (e.g. http://localhost/phpmyadmin/scripts/setup.php). Here is my suggested change for basic internal development usage (after all change, click Configuration -> Save):

Server -> Add
PHP extension to use: mysqli
Authentication type: cookie
Features -> Upload/Download
Upload directory: /tmp
Save directory: /tmp
Features -> Charsets
Allow charset conversion: Yes
Default charset: utf8

Ok, so now copy your newly generated configuration file to correct location and remove your temporary working directory:

cd /var/www/phpmyadmin
cp config/config.inc.php .
chmod 644 config.inc.php
rm -rf config

Is time to access your phpMyAdmin. Go to http://localhost/phpmyadmin, login as root (if this is your new MySQL install, no password is required); go to Privileges, and change all root related account passwords.


Post new comment

The content of this field is kept private and will not be shown publicly.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Allowed HTML tags: <h1> <h2> <h3> <h4> <h5> <h6> <em> <strong> <code> <del> <blockquote> <q> <sub> <p> <br> <ul> <ol> <li> <dl> <dt> <dd> <a> <b> <u> <i> <sup> <acronym> <pre> <img>
  • Lines and paragraphs break automatically.
  • You may post code using <code>...</code> (generic) or <?php ... ?> (highlighted PHP) tags.
  • Images can be added to this post.

More information about formatting options

CAPTCHA
This question is for testing whether you are a human visitor and to prevent automated spam submissions.