Compiling php with "--with-mysql" but for a remote database

Hi there

I am setting up an apache/php instance which will be connecting to a different box for its mysql. I just wanted to know whether I am still required to compile PHP with the “–with-mysql” flag to properly set it up for use with mysql?

The only problem is that I have to install the mysql client locally as the libphp5.so is clearly looking for the ‘libmysqlclient.so.15’ library in the location I define with the “–with-mysql” flag ( e.g.“–with-mysql=/usr/local/mysql” )

If I elect to remove that configure option, what would be the process of manually linking php to a remote mysql ?

any help or advice would be greatly appreciated

MySQL has to be installed on the same server if it’s required by a PHP extension (mysql, mysqli) even if your MySQL DB is remote…

Use the minimal compile flag for MySQL to compile MySQL with the bare minimum, although just a suggestion, compiling MySQL is a tedious job… I would install a MySQL client as is on the same server, and use PHP’s mysqli extension to connect to remote DBs.

The overhead would be the memory usage of MySQL running in the memory… But you can configure it to use minimal resources.

Let me clarify the situations…Compiling PHP using the “–with-mysql” flag DOES NOT compile MySQL on the server, it compiles the extension that lets you connect to MySQL. In order to connect to a MySQL database you need to compile the extension.

Btw, you should really use the MySQLi extension instead. http://www.php.net/manual/en/mysqli.installation.php
By using the MySQLi extension instead, you can use the MySQL Native Driver, which does not require MySQL to be installed.

hi, thanks for the replies.

I will be using the sunfreeware mysql package so wont be compiling it at all

logic_earth : The question was more about whether I need to have any mysql components (libraries, binaries etc) installed locally if I compile php with --with-mysql (or indeed the mysqli equivalent) flag. My database is on another server and ideally i dont really want to install any mysql packages on this server as it will only be running apache/php …

Using the old MySQL extension requires the MySQL library to be available to compile it. MySQLi extension with the native driver does not.

+1 for logic_earth’s answer.

I learn something everyday…

ah so if i compile with “–with-mysqli” then there will be no library calls requirements to locally installed mysql components (like ‘libmysqlclient.so.15’ )?

If thats the case then thats fantastic