Friday, June 7, 2013

Re: SQL Server, Linux and CakePHP 2

"The PDO_SQLSRV extension is only compatible with PHP running on Windows."

http://php.net/manual/en/ref.pdo-sqlsrv.php

The SQLSRV one also won't work - everything is through ODBC MS Drivers.

Linux Users need to install php-odbc and use PDO through that and the MS driver to access the MS SQL Database.

But there is no CakePHP PDO-ODBC datasource for MSSQL I think!

On Wednesday, February 8, 2012 2:32:54 AM UTC+8, trent wrote:
Cake2 uses the new sqlsrv extension for php.  This php extension is
available only from Microsoft.  It is different than the old php-mssql
extension, and much better from what I hear.  Fortunately Microsoft
recently made a linux 64bit version available:

http://www.microsoft.com/download/en/details.aspx?id=28160

However if you cannot install that on your system you will need to use
freetds to get the dblib extension in pdo.  Check your linux package
manager for freetds.  (On ubuntu you simply install the php-sybase
package).

Once installed I would recommend copying the old sqlsrv datasource,
renaming it to something else.  Since it uses PDO the connection
string should be the biggest change:

https://github.com/cakephp/cakephp/blob/master/lib/Cake/Model/Datasource/Database/Sqlserver.php#L131

reference here for the correct reference string:

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

I have used dblib before with PDO, but not with cake, but this should
work.  It would be nice to have an alternative connection though.

Trent



On Feb 7, 10:12 am, Justin Edwards <justinledwa...@gmail.com> wrote:
> I've spent a whole day trying to make this work with 2.x,  no luck from
> linux.
>
> On Tue, Feb 7, 2012 at 8:51 AM, Gianluca Gentile <gianluca.gent...@gmail.com
>
>
>
>
>
>
>
> > wrote:
> > Hi all,
> >  I need to connect my linux server (Debian 6) to Microsoft SQL Server
> > 2005 with CakePHP 2.0.6 but the PDO driver "Sqlserver" not exist for
> > Linux...How it's possible!?
>
> > Sorry for my english... :)
>
> > --
> > Our newest site for the community: CakePHP Video Tutorials
> >http://tv.cakephp.org
> > Check out the new CakePHP Questions sitehttp://ask.cakephp.organd help
> > others with their CakePHP related questions.
>
> > To unsubscribe from this group, send email to
> > cake-php+u...@googlegroups.com For more options, visit this group
> > athttp://groups.google.com/group/cake-php

--
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP
 
---
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscribe@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

No comments: