NuSphere Forums Forum Index
NuSphere Forums
Reply to topic
Conect to sql server 2008


Joined: 09 Jun 2015
Posts: 5
Reply with quote
Hi
I use PHPED 15.0 Build 15036.
I want to connect to a database on SQL Server 2008. I am using the function sqlsrv_connect. When you start getting information: Call to undefined function sqlsrv_connect (). How do I connect to the server and the database?
Thank you for your help
View user's profileFind all posts by JacekSend private message
Guru master

Joined: 24 Jul 2009
Posts: 737
Reply with quote
You are missing the php_mssql extension (note the double-s, it is not php_msql which is a different extension)

Installing/enabling depends on web server and the PHP build. It is also possible to build PHP with some extensions built-in, although I don't think I've ever seen php_mssql compiled into PHP.

On a Windows web server, your XAMP/WAMP package *might* include the required extensions but often with PHP the extensions are disabled by default, so you have to enable them.

You may also require php_odbc. You will probably find php_odbc is included with your PHP, but might not have php_mssql, in which case you are going to have to search for a compatible extension.

Check both in the php.ini for a commented out extension line and even if there is not a commented out line, also check in the PHP extensions directory to see if php_mssql.dll is there, because if it is then you can add the line to php.ini yourself.

If your web app is going to run on a public web servers, many of those do not have php_odbc and php_mssql enabled. To install those extensions on a Linux server I had to install freetds, php-odbc and php-mssql

Depending on where the SQL Server is located, also consider any firewalls that may interfere with communication.
View user's profileFind all posts by plugnplaySend private message


Joined: 09 Jun 2015
Posts: 5
Reply with quote
Thank you for your response.
My instance PHP does not have php_mssql Sad. I plugged while php_pdo_sqlsrv_55_ts.dll and php_sqlsrv_55_ts.dll - helped to solve the problem for an application residing on a different server - not local. If Debug an application on the local server I still have this problem. Perhaps I wrong my configured properties for the project. Give you trying to dispel my problem
Thanks for all the suggestions.
View user's profileFind all posts by JacekSend private message
Guru master

Joined: 24 Jul 2009
Posts: 737
Reply with quote
Those modules should probably work. Are the modules loading correctly and shown in phpinfo() ?
View user's profileFind all posts by plugnplaySend private message


Joined: 09 Jun 2015
Posts: 5
Reply with quote
Hi
Yes - I can see the modules in phpinfo.
sqlsrv
sqlsrv support enabled
Version 3.0.2.2R (Unofficial)
Unofficial Changes Works with Native Clients 11/10/9

Directive Local Value Master Value
sqlsrv.ClientBufferMaxKBSize 10240 10240
sqlsrv.LogSeverity 0 0
sqlsrv.LogSubsystems 0 0
sqlsrv.WarningsReturnAsErrors On On


pgsql
PostgreSQL Support enabled
PostgreSQL(libpq) Version 9.2.2
PostgreSQL(libpq) Uninitialized version string (win32)
Multibyte character support enabled
SSL support disabled
Active Persistent Links 0
Active Links 0

pdo_sqlsrv
pdo_sqlsrv support enabled
Version 3.0.2.2R (Unofficial)
Unofficial Changes Works with Native Clients 11/10/9

pdo_sqlite
PDO Driver for SQLite 3.x enabled
SQLite Library 3.8.4.3


pdo_pgsql
PDO Driver for PostgreSQL enabled
PostgreSQL(libpq) Version 9.2.2
Module version 1.0.2
Revision $Id: 8e4cc97fb53f418d98b489c3e9d722e48446e676 $
View user's profileFind all posts by JacekSend private message
Guru master

Joined: 24 Jul 2009
Posts: 737
Reply with quote
Just as a clarification:

php_mssql provides mssql_ functions, including mssql_connect()
php_sqlsrv provides sqlsrv_ functions, including sqlsrv_connect()

I've just installed the PHP 5.4 versions of those modules and php_pdo_sqlsrv on a PHP 5.4 server and they are working fine with both commands.

Do you also have the php_pdo module enabled? I assume you do, otherwise the other PDO modules probably wouldn't show they are enabled. My PHP has php_pdo compiled in at build time.

Maybe also check the Apache logs for any module startup errors.

Is there anything at http://go.microsoft.com/fwlink/?LinkId=163712 that is useful?
View user's profileFind all posts by plugnplaySend private message


Joined: 09 Jun 2015
Posts: 5
Reply with quote
Hi
How do I enable module php_pdo_sqlsrv in my PhpED?
View user's profileFind all posts by JacekSend private message
Guru master

Joined: 24 Jul 2009
Posts: 737
Reply with quote
You don't have to and I'm not sure if there is anything you could add anyway. I think php_pdo_sqlsrv is just an interface from php_sqlsrv (which does have commands) to PDO.

Remember that PhpED doesn't run the code, the web server does, so even if PhpED doesn't recognise commands they will still execute fine on the web server if the required extensions are installed.

For some modules you might want to add things to PhpED to give you code completion, but PhpED already has sqlsrv and mssql.
View user's profileFind all posts by plugnplaySend private message


Joined: 09 Jun 2015
Posts: 5
Reply with quote
Hi
Ok - thanks a lot for your help.
View user's profileFind all posts by JacekSend private message
Conect to sql server 2008
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
All times are GMT - 5 Hours  
Page 1 of 1  

  
  
 Reply to topic