Cannot connect to MS SQL Server

General discussion on Zend Studio

Moderator: natalia_b_zend

Cannot connect to MS SQL Server

Postby rola7895 on Wed Dec 14, 2016 2:30 pm

I am new to Zend and PHP. I started today and tried to connect to one of my SQL Server Databases, fetch all rows from a table and display them.
I get the errorr 'Fatal error: Uncaught Error: Call to undefined function sqlsrv_connect() in ...', though sqlsrv is shown in phpinfo and the studio-editor shows description and parameters of this function.

What I did:
* Installed xampp an Windows 7/32 Bit
* Installed Zend Studio 13.5 Trial
* On the welcome page selected MSSQL support and SQL Development Tools and restarted
* Installed php_sqlsrv_7_ts_x86.dll and php_pdo_sqlsrv_7_ts_x86.dll and added to php.ini
* Restarted apache
* Created new local PHP project with PHP Version 7.0
* Wrote some code into index.php
* Run index.php as CLI PHP Application

What am I doing wrong?
rola7895
 
Posts: 1
Joined: Wed Dec 14, 2016 2:07 pm

Re: Cannot connect to MS SQL Server

Postby zvika on Thu Dec 15, 2016 3:54 pm

Hello
You need to debug on the web PHP (XAMPP in your setup) with Zend debugger / Xdebug, in order to get the additional extension reflected in Zend Studio session.
You can also add the SQL extensions to the Zend Studio PHP CLI environment (by editing the php.ini or using your own NEW PHP CLI runtime) - I never tried SQL through CLI but it might be supported as it can make TCP connections and use sockets.
Check phpinfo() in your debug session, not only in your XAMPP, if you use any other PHP runtime (Zend Studio internal PHP, or additional PHP you set up in PHP executables preferences).
Zvika Dror
Zend Support Team
User avatar
zvika
Zend Global Support
 
Posts: 966
Joined: Sun Dec 14, 2008 9:48 am


Return to Zend Studio

Who is online

Users browsing this forum: Google [Bot] and 4 guests