Page 1 of 1

php_pdo_sqlsrv driver

PostPosted: March 22nd, 2012, 4:54 pm
by dacami
hello!

i want to ask if there is a way to enable php_pdo_sqlsrv_53_nts_vc9.dll extension for ms sql server to build a php commandline executeable?

thanks,
dacami

Re: php_pdo_sqlsrv driver

PostPosted: March 22nd, 2012, 5:01 pm
by Jakub Misek
Hi!

PDO is currently not supported. It has to be reimplemented into .NET, since .NET is not able to use PDO drivers from native PHP directly.

PDO is planned, however the implementation was not started yet. Currently there is MSSQL extension available, instead of PDO sql server driver.

Re: php_pdo_sqlsrv driver

PostPosted: March 22nd, 2012, 5:23 pm
by dacami
ok, so maybe it is possible to use the php_sqlsrv.dll from microsoft which isn't PDO?

Re: php_pdo_sqlsrv driver

PostPosted: March 22nd, 2012, 5:49 pm
by Jakub Misek
php_sqlsrv.dll is native DLL written in C language. Its PHP4 version is possible to use from Phalanger, but Phalanger comes already with its reimplementation into C# which is better.

To use mssql extension (http://php.net/manual/en/book.mssql.php) from Phalanger, add following into .config file, into <phpNet><classLibrary> section:
Code: Select all
<add assembly="PhpNetMsSql, Version=3.0.0.0, Culture=neutral, PublicKeyToken=2771987119c16a03" section="mssql"/>

or
Code: Select all
<add assembly="php_mssql.mng, Version=3.0.0.0, Culture=neutral, PublicKeyToken=4ef6ed87c53048a3" section="mssql-native" />


The second option will load original PHP php_mssql extension, the first one is its .NET reimplementation.

Re: php_pdo_sqlsrv driver

PostPosted: March 22nd, 2012, 9:53 pm
by dacami
thanks for your help!

i tried to use php_mssql.dll, but now my problem is im using win7 64bit os and it throws an error that native extensions only build for 32bit. why can't i choose x86 in my vs2010 configuration manager? only any-cpu option is available?

Re: php_pdo_sqlsrv driver

PostPosted: March 23rd, 2012, 8:58 am
by Jakub Misek
There are several options:
- use only managed libraries, so your project will run as x64 process without issues. I would definitely replace native php_mssql with PhpNetMsSql which runs x64.
- create post-build action, that will mark your EXE as 32bit only, so it will start is 32-bit app, and all the native PHP extensions will load properly.
Code: Select all
"C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\Bin\corflags.exe" /32BIT  myapp.exe


We will take a look on the configuration manager. It should definitely allow compiling in x86 (even automatically)