The Shed is going Social! Join us on FaceBook and Twitter and chime in on the conversation.
|
 |
|
Dev Shed Forums
> Programming Languages
> PHP Development
|
PHP-Extension - MS SQL Connection
Discuss MS SQL Connection in the PHP Development forum on Dev Shed. MS SQL Connection PHP Development forum discussing coding practices, tips on PHP, and other PHP-related topics. PHP is an open source scripting language that has taken the web development industry by storm.
|
|
 |
|
|
|
|

Dev Shed Forums Sponsor:
|
|
|

January 8th, 2013, 12:10 PM
|
|
Registered User
|
|
Join Date: Jan 2013
Posts: 2
Time spent in forums: 23 m 48 sec
Reputation Power: 0
|
|
|
PHP-Extension - MS SQL Connection
I am pretty new to php, and I feel like I am missing something pretty fundamental. I am trying to connect to SQL Server. I have set up a wamp server on my desktop.
I have downloaded SQLSRV30.EXE and installed the files in C:\wamp\bin\php\php5.3.10\ext.
I have added the following line to the C:\wamp\bin\php\php5.3.10\php.ini file in the Extensions section:
extension=php_sqlsrv_53_ts.dll
and restarted the server.
I have seen other web sites that tell me I should see sqlsvr in the Registered PHP Streams (in the phpinfo page. I do not. And of course the sqlsvr calls don't work.
I receive errors like: Fatal error: Call to undefined function sqlsrv_connect()
Here is at least one piece I really don't understand. In my phpinfo page the "Loaded Configuration File " reads, "C:\wamp\bin\apache\Apache2.2.21\bin\php.ini" However, this doesn't seem to be the case. I have renamed that file, and I have modified that file in various ways, and it seems to have no affect. However, when I modify the C:\wamp\bin\php\php5.3.10\php.ini, and restart the server, it clearly does have affect. For instance, I tried the nts version and when I restarted the server, it failed pretty dramatically.
jic, I put the extension line in both php.ini files.
Anyway, I feel like I am missing something pretty fundamental. Any help would be appreciated.
Thanks
urisk
|

January 9th, 2013, 11:00 PM
|
|
|
Just wondering if you installed the WAMP stack why not use the MySql server that came with the distribution that is pre-configured with php?
As far as using msSQL i would not use the sqlsrv extension instead use Php Data Objects or PDO. However either way you also need the sql server native client installed as well.
Quote: | Originally Posted by urisk23 I am pretty new to php, and I feel like I am missing something pretty fundamental. I am trying to connect to SQL Server. I have set up a wamp server on my desktop.
I have downloaded SQLSRV30.EXE and installed the files in C:\wamp\bin\php\php5.3.10\ext.
I have added the following line to the C:\wamp\bin\php\php5.3.10\php.ini file in the Extensions section:
extension=php_sqlsrv_53_ts.dll
and restarted the server.
I have seen other web sites that tell me I should see sqlsvr in the Registered PHP Streams (in the phpinfo page. I do not. And of course the sqlsvr calls don't work.
I receive errors like: Fatal error: Call to undefined function sqlsrv_connect()
Here is at least one piece I really don't understand. In my phpinfo page the "Loaded Configuration File " reads, "C:\wamp\bin\apache\Apache2.2.21\bin\php.ini" However, this doesn't seem to be the case. I have renamed that file, and I have modified that file in various ways, and it seems to have no affect. However, when I modify the C:\wamp\bin\php\php5.3.10\php.ini, and restart the server, it clearly does have affect. For instance, I tried the nts version and when I restarted the server, it failed pretty dramatically.
jic, I put the extension line in both php.ini files.
Anyway, I feel like I am missing something pretty fundamental. Any help would be appreciated.
Thanks
urisk |
|

January 10th, 2013, 02:58 PM
|
|
Registered User
|
|
Join Date: Jan 2013
Posts: 2
Time spent in forums: 23 m 48 sec
Reputation Power: 0
|
|
Quote: | Originally Posted by portcitysoftwar Just wondering if you installed the WAMP stack why not use the MySql server that came with the distribution that is pre-configured with php?
As far as why. I already had the WAMP stack installed for my own purposes. Then my boss wanted me to look into web-enabling some of our software functionality. So I wanted to just start with my personal web server, on my workstation, just to keep things simple.
As far as using msSQL i would not use the sqlsrv extension instead use Php Data Objects or PDO. However either way you also need the sql server native client installed as well. |
Regarding, using PDO, I probably will ultimately do this. This same SQL Server driver installs php_pdo_sqlsrv_53_ts.dll. I just wanted to establish a connection first.
I do have the SQL Server Native Client Installed. I use SQL Server and all of its tools in my day to day work.
Any insight would be helpful. Thanks.
|

January 10th, 2013, 09:37 PM
|
|
|
Unfortunately I don't have any more insight for you. I hate Microsoft products. hadn't even personally owned a windows machine sense XP. Quote: | Originally Posted by urisk23 Regarding, using PDO, I probably will ultimately do this. This same SQL Server driver installs php_pdo_sqlsrv_53_ts.dll. I just wanted to establish a connection first.
I do have the SQL Server Native Client Installed. I use SQL Server and all of its tools in my day to day work.
Any insight would be helpful. Thanks. |
|
Developer Shed Advertisers and Affiliates
| Thread Tools |
Search this Thread |
|
|
|
| Display Modes |
Rate This Thread |
Linear Mode
|
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
|
|