I know that there is some discussion on PHP & SQL Server, but most of this is a few years old, and predates PHP; not much mentions PDO either.
I have a client who wants to access their SQL Server database from their web server. The Web Server is Apache running on Ubuntu Linux, while the SQL Server is running on a separate Windows box.
Most of what I have been able to find is dated, especially since PHP 7 came out.
What do I need to install to get PHP & PDO connecting to to a remote SQL Server?
I am trying to connect to a MS Access Db that I have made from my apache server using PHP. I keep coming up with the error "could not find driver". I have searched through just about every web page on the internet and have found nothing of importance. I have undocumented the parts of the php.ini file to allow the odbc drivers to work. I also have tried to list all of the working drivers using the PDO::getAvailableDrivers() code yet nothing shows up no matter how many drivers I undocument from the php.ini file. I've created the DNS connection and linked it to the database yet I'm not sure how to connect to it.
Any help would be greatly appreciated.
For everyone else that needs an answer to this:
MS Access has stopped updating and hosting their odbc connection to php in 2010 (approximately). It will still work if you make sure you're using a 32-bit system. I'm now using 32-bit Apache and PHP. It works flawlessly now.
Does anyone know if it's possible to connect and query an MS Access database from a Linux Server using PHP?
If it is possible I'm thinking install ODBC driver on the Linux server, but will it work to connect to Access is the question. I've read it's possible with MSSQL.
My knowledge is very limited when it comes to any Windows related DBs so any advice much appreciated.
Yes, it's possible. I've done it using ODBTP, which took advantage of the ODBC driver on the (Windows) machine that hosted the Access database file.
It's also theoretically possible to use an ODBC driver on the Linux server to read an Access database on a Windows networking share if the Linux box can "see" it. However, I've never had very good luck with Access ODBC on Linux so I wouldn't recommend spending too much time trying to get it working.
I have used default MS SQL driver to connect to a SQL server in a php application.
I'm using XAMPP 1.6.8. my php version is 5.2.6.
Application was connected successfully to the SQL server and the application was running successfully for a long time. Now suddenly the application is showing an error on mssql_connect() function with same MS SQL access information.
the error is "Unable to connect to server: xxx.xxx.xxx.xxx"
I also checked the SQL server access info with a SQL client. SQL client can connect successfully, therefore i think the access info is correct.
Can any one help me resolved this issue?
Thx
I just found my solution here. http://jimmyli.net/2009/03/php-unable-to-connect-to-mssql/ .problem was that the file ntwdblib.dll packaged with PHP5 was an old version. then i just replace with updated one from here http://jimmyli.net/wp/wp-content/uploads/2009/03/ntwdblib.zip
Thx
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. *
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...
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
you will need to install the mysql extensions. this link should help: http://php.net/manual/en/install.windows.extensions.php
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.