# Setup Apache and Mysql on different machines

## xathin

I have been searching over the internet for a while trying to find a way to do this, but I haven't been able to find anything, or I've been searching for the wrong things.

What I'm trying to do is to have one machine run Apache, PHP, PHPMyAdmin, etc, and another machine to run MySQL (possibly some other things as well). When installing PHPMyAdmin, or anything else which has mysql(i) use flags, it automatically pulls in MySQL. I would like to know if it's possible to have the MySQL support on the Apache machine without actually installing MySQL on it, and have it recognize that it is installed on another machine.

----------

## cach0rr0

just had a quick look at the ebuilds in question

-the php ebuild does not pull in mysql, nor recognize the 'mysql' use flag 

-the apache ebuild does not pull in mysql, nor recognize the 'mysql' use flag

you can confirm the same with a quick:

```

laptop02 ~ # grep -i mysql /usr/portage/dev-lang/php/php-5.2.12.ebuild

laptop02 ~ # grep -i mysql /usr/portage/www-servers/apache/apache-2.2.14-r1.ebuild

laptop02 ~ #

```

so your solution would be to emerge only php and apache on the one server

but do NOT do the installation of phpmyadmin through portage. Myself and many others recommend doing your installation of webapps outside of portage, the old fashioned way.

----------

## xathin

I realize that apache does not have mysql use flag, but php definately does. If you do 'emerge -pv php', you will see both mysql and mysqli in the use flags.

Without the mysql or mysqli use flags in php enabled, IIRC phpmyadmin will not install through portage (rebuilding php as I write to test). Is this true if not installing phpmyadmin through portage?

Also, would the same be true for things like django and dev-python/mysql-python?

----------

## xathin

Ok, rebuilt php without the mysql and mysqli flags, downloaded the latest phpmyadmin (3.2.5), and got this message when trying to access the phpmyadmin site:

```
phpMyAdmin - Error

Cannot load mysql extension. Please check your PHP configuration. - Documentation
```

I'm assuming this is due to not having mysql support built into php. But to have mysql support (with use flags), mysql gets pulled in automatically. Either I'm doing something wrong, or I'm just missing something with this setup.

----------

## Mad Merlin

Try enabling the minimal USE flag for the mysql ebuild, that way it won't build the server, just the headers and client libraries. You definitely need the headers and client libraries to connect to a remote mysql instance.

----------

