Page 1 of 1

mssql_pconnect

Posted: Fri Mar 23, 2012 10:33 pm
by aostad
Attempting to connect to mssql, as a result of following line, it returns 'null':
if (!function_exists('mssql_pconnect')) return null;

Any idea/solution?

Re: mssql_pconnect

Posted: Sat Mar 24, 2012 2:42 am
by TurboPT
If you can edit the php.ini file, and this is not a production environment, it is possible to [temporarily] set:

display_errors = On // default is Off

To show the error[s] directly on the page. Make sure to restart the webserver after applying this change.

To the original question: I would say yes for MSSql, but the configuration might be tricky...

Is the mssql extention loaded, or available ? If so, there would be a php_mssql.dll file being loaded in the configuration. Search the php.ini file, it might be there, but may be commented-out with a ;
Of course, that dll should be available within the PHP installation as well.

But know there could be other configuration factors involved. [url, user/pass, etc]

Again, as with any changes to php.ini requires a restart of the webserver.

Re: mssql_pconnect

Posted: Sat Mar 24, 2012 9:56 pm
by aostad
Thank you very much for the hint. I've turned on the display_error. This is what I get:
Fatal error: Call to undefined function mssql_get_last_message() in C:\Program Files\Apache Software Foundation\Apache2.2\htdocs\testlink\third_party\adodb\drivers\adodb-mssql.inc.php on line 545

I'm trying to connect to TFS (MS Team Foundation Server) database, which is sqlServer.

Re: mssql_pconnect

Posted: Sun Mar 25, 2012 4:19 am
by TurboPT
Ok, but that only covers the first part of my previous post, so that you can see warnings/errors on the page...

What about the other part:
TurboPT wrote: ... I would say yes for MSSql, but the configuration might be tricky...

Is the mssql extention loaded, or available ? If so, there would be a php_mssql.dll file being loaded in the configuration...
Also, if you have the php command-line available, you could also check existence like this:
[the command is the same on Linux]

Code: Select all

C:\Users\TurboPT>php --rf mssql_pconnect
..and...
C:\Users\TurboPT>php --rf mssql_get_last_message
For both, since I don't have mssql configured, I get:

Exception: Function mssql_pconnect() does not exist
Exception: Function mssql_get_last_message() does not exist

Re: mssql_pconnect

Posted: Sun Mar 25, 2012 5:46 am
by aostad
It looks like there is no php_mssql.dll but there is php_pdo_sqlsrv_53_nts_vc6.dll. Since the TFS database is sqlServer I've downloaded and installed sqlServer driver from MS (http://msdn.microsoft.com/en-us/sqlserver/ff657782.aspx).
A bunch of php_pdo_sqlsrv_*.dll and php_sqlsrv_*.dll have been installed in PHP\ext directory.

Since my php is 5.3.7, I've added following line in php.ini:
extension=php_pdo_sqlsrv_53_nts_vc6.dll

and this one for mssql:
extension=php_pdo_mssql.dll

I get following errors by running your suggested commands:
C:\php\ext>php --rf mssql_pconnect
PHP Warning: PHP Startup: Unable to load dynamic library 'C:\php\ext\php_pdo_ms
sql.dll' - The specified module could not be found.
in Unknown on line 0
PHP Warning: PHP Startup: Unable to load dynamic library 'C:\php\ext\php_pdo_sq
lsrv_53_nts_vc6.dll' - The specified module could not be found.
in Unknown on line 0
Exception: Function mssql_pconnect() does not exist


Since there is no php_pdo_mssql.dll, the first error is obvious, however, I don't know why it can not find php_pdo_sqlsrv_53_nts_vc6.dll.

Since I use MySQL for test link database, I've not installed mssql at the time. I should find out how to add PHP driver for mssql now.

Re: mssql_pconnect

Posted: Sun Mar 25, 2012 2:37 pm
by TurboPT
Restart the server after making the extension change?

Taking a brief look through the link you posted, I did find with "system requirement", that is had this:
MS-info-link wrote: Microsoft SQL Server 2008 R2 Native Client is required to use Microsoft Drivers for PHP for SQL Server.
Do know if that is installed? If not, they have a link at the requirements where I found that info.

Re: mssql_pconnect

Posted: Tue Mar 27, 2012 3:31 am
by aostad
I had to replace php-5.3.17 with php-5.2.17 and install sql server clien tool.

Cheers,
AO

Re: mssql_pconnect

Posted: Tue Mar 27, 2012 12:31 pm
by TurboPT
It's annoying that you had to go back a version [...MicroSoft is supposed to be easier??]

Anyway, whatever it takes to get it working, I guess...