Showing posts with label php. Show all posts
Showing posts with label php. Show all posts

Thursday, March 22, 2012

Can not connect to mssql with php

Using mssql_connect($server, $user, $password) results in different ways the 'php server'

connects to the sql server.

On a workstation with WinXPProf, php uses the $user and $password to login and uses the

sql server authentication. Running the same script from a W2K3 server results in an error

because in this case the 'php server' tries to connect to the sql server using windows

authentication. (I have checked this difference with wireshark)

The problem has nothing to do with the sql server settings (mixed mode) / firewalls /

php.ini- file settings or versions of ntwdblib.dll because these are the same for both

connections. The problem looks more fundamental, probably due to settings in windows or

the iis version running on the server and the workstation.

Does anyone has a clue how to force php to use sql server authentication.

Pitching Theo pitcher_32@.hotmail.com

It should be as simple as setting mssql.secure_connection = Off in your php.ini. (Informative thread) If that still doesn't do it, check the output of the phpinfo() function to make sure php is using the php.ini file that you believe it is (I've had that bite me in the butt once or twice before).
|||

Like I said both php boxes read the php.ini file and yes mssql.secure_connection = Off.

This is also confirmed by phpinfo().

It seems to be a problem for more than 4 years now checking all sort of discussions

on the net. A lot of people mention this problem but no one seems to know why one

php box tries to login to the sql server with "serverName\IUSR_serverName"

(anonymous IIS account) and the other php box with an empty string continuing with

an sql server authentication providing $user and $password from the mssql_connect()

function. Like I said it doesn't look a php problem/setting but a windows specific thing.

Anyone has a clue ? please let me know

sql

Can not connect to mssql with php

Using mssql_connect($server, $user, $password) results in different ways the 'php server'

connects to the sql server.

On a workstation with WinXPProf, php uses the $user and $password to login and uses the

sql server authentication. Running the same script from a W2K3 server results in an error

because in this case the 'php server' tries to connect to the sql server using windows

authentication. (I have checked this difference with wireshark)

The problem has nothing to do with the sql server settings (mixed mode) / firewalls /

php.ini- file settings or versions of ntwdblib.dll because these are the same for both

connections. The problem looks more fundamental, probably due to settings in windows or

the iis version running on the server and the workstation.

Does anyone has a clue how to force php to use sql server authentication.

Pitching Theo pitcher_32@.hotmail.com

It should be as simple as setting mssql.secure_connection = Off in your php.ini. (Informative thread) If that still doesn't do it, check the output of the phpinfo() function to make sure php is using the php.ini file that you believe it is (I've had that bite me in the butt once or twice before).
|||

Like I said both php boxes read the php.ini file and yes mssql.secure_connection = Off.

This is also confirmed by phpinfo().

It seems to be a problem for more than 4 years now checking all sort of discussions

on the net. A lot of people mention this problem but no one seems to know why one

php box tries to login to the sql server with "serverName\IUSR_serverName"

(anonymous IIS account) and the other php box with an empty string continuing with

an sql server authentication providing $user and $password from the mssql_connect()

function. Like I said it doesn't look a php problem/setting but a windows specific thing.

Anyone has a clue ? please let me know

Thursday, March 8, 2012

Can I use stored procedures with PHP via ODBC bridge?

Hey Everyone,

I am a stored procedures newbie, so I wanted to ask if it is possible
to use them with PHP via an ODBC-ODBC bridge connected to a MS SQL
server. I am simply use the commands from the php odbc library to
connect and execute the SQL commands, I am trying to avoid building
dynamic queries, so stored proceddures seem to be the answer. I know
that there are only certain environments stored procedures can be used
within. Thank you for all of your help.Storedprocs can be started through queries which should not bring any
problems in using them with PHP, but test it.
I don't know how the query_resource (return value) is handled in a
Stored proc but I believe any return values wll be returned in fieldlike
structures.
Anyway thats how it works in Pascal...
Working in PHP&MySQL platforms haven't given me the opportunity to test
that functionality in PHP.

Regards,
Toke Herkild

gene.ellis@.gmail.com wrote:
> Hey Everyone,
> I am a stored procedures newbie, so I wanted to ask if it is possible
> to use them with PHP via an ODBC-ODBC bridge connected to a MS SQL
> server. I am simply use the commands from the php odbc library to
> connect and execute the SQL commands, I am trying to avoid building
> dynamic queries, so stored proceddures seem to be the answer. I know
> that there are only certain environments stored procedures can be used
> within. Thank you for all of your help.|||Yes, it it is possible, and works OK.

Check out the latest PHP manual ==> Function Reference ==> Microsoft
SQL Server Functions ==> mssql_execute().

HTH,
Rob