SitePoint Sponsor

User Tag List

Results 1 to 7 of 7
  1. #1
    SitePoint Zealot
    Join Date
    Sep 2004
    Location
    london
    Posts
    160
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    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

  2. #2
    Founder of Primal Skill Ltd. feketegy's Avatar
    Join Date
    Aug 2006
    Posts
    482
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    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.

  3. #3
    . shoooo... silver trophy logic_earth's Avatar
    Join Date
    Oct 2005
    Location
    CA
    Posts
    9,013
    Mentioned
    8 Post(s)
    Tagged
    0 Thread(s)
    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.
    Logic without the fatal effects.
    All code snippets are licensed under WTFPL.


  4. #4
    SitePoint Zealot
    Join Date
    Sep 2004
    Location
    london
    Posts
    160
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    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 ...

  5. #5
    . shoooo... silver trophy logic_earth's Avatar
    Join Date
    Oct 2005
    Location
    CA
    Posts
    9,013
    Mentioned
    8 Post(s)
    Tagged
    0 Thread(s)
    Using the old MySQL extension requires the MySQL library to be available to compile it. MySQLi extension with the native driver does not.
    Logic without the fatal effects.
    All code snippets are licensed under WTFPL.


  6. #6
    Founder of Primal Skill Ltd. feketegy's Avatar
    Join Date
    Aug 2006
    Posts
    482
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by logic_earth View Post
    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...

  7. #7
    SitePoint Zealot
    Join Date
    Sep 2004
    Location
    london
    Posts
    160
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    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


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •