3

We have an application which uses WAMP server. Now, there is a new requirement from a customer who wants to use MS SQL Server instead of MySQL. How easy is it to port to SQL Server from MySQL. Also it has to retain this configuration. Apache->PHP->SQL Server on windows. How can I connect from Apache to SQL Server. Hope PHP works well with SQL server.

Please advise.
Thanks,
Vish

marc_s
  • 732,580
  • 175
  • 1,330
  • 1,459
Blue Sky
  • 807
  • 1
  • 15
  • 36

3 Answers3

3

You don't need to do anything special with Apache, you just need to use the correct interface in PHP. That is, the mssql stuff that Tobias linked to, or - perhaps better - PDO which can be configured to use either MySQL or MS SQL. PDO would probably be a lot easier going forward if you have to end up supporting both database engines.

In terms of differences between the MySQL and SQL Server, there are quite a lot unfortunately. Most annoying will be that the syntax for certain types of queries will be slightly different (and DDL - that is, creating tables, indexes and so on - is completely different!) Though they both support a big enough subset of standard SQL that you can usually find a way to do most everything that works in both of them. But don't expect to just connect to SQL Server and have all of your queries written for MySQL "just work" - unfortunately, they won't.

I guess in the end, the easiest thing to do is just to try it out. If it looks like it's going to be too much (for example, if you're using a lot of 'obscure' MySQL features), then you might have to rethink your options.

Dean Harding
  • 71,468
  • 13
  • 145
  • 180
  • Thanks Tobias and Codeka, yes will try it out first and lets see how it goes. – Blue Sky Jun 03 '10 at 06:04
  • I'd rather use the sqlsvr extension than the dblib based mssql on a Wamp server. It also provides a PDO driver. see http://msdn.microsoft.com/en-us/library/ee229551%28v=SQL.10%29.aspx – VolkerK Jun 03 '10 at 07:46
  • Hi Volker, So can I just add this sqlsvr extension to my existing WAMP server and then tune PHP to talk to MS SQL? – Blue Sky Jun 03 '10 at 09:45
1

There are huge differences between MYSQL and MS even in basic queries.
So, all your database work should be rewritten.
The rest is not a big deal.

Your Common Sense
  • 156,878
  • 40
  • 214
  • 345
0

I'm guessing you mean MSSQL?

http://us2.php.net/mssql

mySQL... msSQL ... basically the same. You shouldn't have any problems if you don't use "fancy" queries - best would be just to try it out and see what happens.

Tom H
  • 46,766
  • 14
  • 87
  • 128
Toby
  • 2,720
  • 5
  • 29
  • 46