hcclnoodles — 2012-10-01T07:03:05-04:00 — #1
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
feketegy — 2012-10-01T08:47:09-04:00 — #2
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.
logic_earth — 2012-10-01T15:05:05-04:00 — #3
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.
hcclnoodles — 2012-10-02T06:47:17-04:00 — #4
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 ...
logic_earth — 2012-10-02T07:18:00-04:00 — #5
Using the old MySQL extension requires the MySQL library to be available to compile it. MySQLi extension with the native driver does not.
feketegy — 2012-10-02T08:00:17-04:00 — #6
+1 for logic_earth's answer.
I learn something everyday...
hcclnoodles — 2012-10-03T12:30:08-04:00 — #7
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