2

While I've been working with MySQL for years, this is the first time I've run across this very newbie-esq issue. Due to a client demand, I must host their website files (PHP) on a IIS server that is not running MySQL (instead, they are running MSSQL). However, I have developed the site using a MySQL database which is located on an external host (Rackspace Cloud). Obviously, my mysql_connect function is now bombing because MySQL is not running on localhost.

Question: Is it even possible to hit an external MySQL database if localhost is not running MySQL?

Apologies for the rookie question, and many thanks in advance.

* To clarify, I know how to connect to a remote MySQL server, but it is the fact that my IIS web server is not running ANY form of MySQL (neither server nor client) that is giving me trouble. Put another way, phpinfo() does not return anything about MySQL. *

4 Answers 4

3

Yes, you can use a MySQL database that's not on the same machine as Apache+PHP.

Basically, you'll connect from PHP to MySQL via a network connection -- TCP-based, I suppose ; which means :

  • MySQL must be configured to listen to, and accept connections on the network interface
    • Which means configuring MySQL to do that
    • And given the required privileges to your MySQL user, so he can connect from a remote server
  • And PHP must be able to connect to the server hosting MySQL.

Note, though, that habing MySQL on a server that's far away might not be great for performances : each SQL query will have to go through the network, and this could take some time...

Sign up to request clarification or add additional context in comments.

Comments

0

If phpinfo is not returning anything about MySQL you need to install the MySQL plugin for PHP, easiest way to do that probably is to just upgrade PHP to the latest version. If not there is a .DLL file that you will need.

http://www.php.net/manual/en/mysql.installation.php

Comments

0

you will need to install the mysql extensions. this link should help: http://php.net/manual/en/install.windows.extensions.php

Comments

0

The MySQL server has nothing to do with PHP itself. What "mysql support" in PHP means is that it's been compiled with (or has a module loaded) that implements the MySQL client interface. For windows, it'd be 'mysql.dll', and on Unix-ish systems it'd be 'mysql.so'. Once those are loaded, then the various MySQL intefaces (mysql_xxx(), mysqli_xxx(), PDO, MDB2, etc...) will be able to access any MySQL server anywhere, as long as you have the proper connection string.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.