5

I'm trying to get PDO's to work with SQL Server and I'm completely lost. I found this :

http://www.php.net/manual/en/ref.pdo-dblib.php

http://pecl.php.net/package/PDO_DBLIB

and told to try this:

sudo apt-get install php5-mssql

I downloaded the pecl, but I have no idea what it is or where it goes. The manual didn't help and even if the sudo command did work, I have no clue where to type it...

I will fully admit, I am completely ignorant of all of this and don't even know where to start at this point.

My server is hosted by some hosting company, it's a LAMP, I can log into cPanel. That's all I know.

Will
  • 211
  • 1
  • 3
  • 8

2 Answers2

5

I have successfully installed the PDO_DBLIB on my local and hosted servers.

The local server was easy as I had complete root access. To install PDO_DBLIB, all I did was run this command on the Ubuntu LAMP server I set up.

sudo apt-get install php5-sybase

To install this on my hosted server was a slightly different matter. I had to call them and tell them what I wanted. After confusing a Level 1, I was escalated and they informed me that it would be a billable custom service. The server was running Cent OS (which I don't really know that well) so I'm not sure what exactly was done, but they were able to complete my request without any major issues. The host was HostGator and it cost me around $35.

Side note/warning, PDO_DBLIB has a relatively serious but simple issue as of 5.4.9 that hasn't been fixed quite yet, so I'd hold back to an older version for a little while.

Will
  • 211
  • 1
  • 3
  • 8
  • 1
    Your adventures with your provider are not really relevant in this case. – Sven Jan 30 '13 at 15:20
  • 2
    They absolutely are. My question was regarding how to install the driver on a server. I answered how to do this technically and clarified what I, and most likely others, had to do to get it on a VPS that doesn't offer root access. The details might be slightly superfluous and not applicable to some, but I figured my experiences might help others. – Will Jan 30 '13 at 16:11
1

If all you have is cPanel access to your server, then you will have to contact your hosting company's technical support to help you set this up.
You can use the php5 mssql extension to talk to Sql Server via a linux machine, but you have to install http://www.freetds.org on the server first.

http://www.php.net/manual/en/mssql.setup.php gives a good detailed overview of what is required with installing the mssql extension once freetds is installed. But this requires shell access to the server and typically either sudo or root access.

Joe
  • 345
  • 1
  • 5