473,405 Members | 2,210 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,405 software developers and data experts.

Accessing MSSQL 2005 from PHP

Claus Mygind
571 512MB
I am currently running:

1. xP Windows 32 bit
2. Apache 2.2.11.0 http server
3. PHP 5.3.3.0

I want to enable connecting php with MS SQL server 2005 to read files.

I see that php_mssql.dll is no longer supported from php version 5.3 on

After reading numerous online post about the topic, I have not been able to find or install the newer sqlsrv.dll file needed for php 5.3.x

I am in the process of converting an older dBase app to php on my web server. With dBase, I have no trouble connecting to the MS SQL server via the ODBC. Since sqlsvr.dll uses the ODBC connection and my dBase app can connect with the server, this seems the way to go.

Could someone provide a link for downloading sqlsrv.dll? And also provide some step by step instructions of how to add to my existing php installation?

I am hoping is is something like:
1. download sqlsvr.dll into your c:\php\ext folder
2. modify your php.ini to include the line - extension=php_sqlsvr.dll
3. restart web server.
Jun 11 '12 #1

✓ answered by Claus Mygind

Thanks to the help here, I was able to install the right "SQL Server Native Client" and the correct php SQL .dll file on my Apache Web Server so I can now use php script to access data on our SQL Server in addition to our MySQL server.

Because there are different versions of php and SQL servers. I am only going to describe my steps, but instructions on how to properly install for other configurations can be gleaned from the links provide here.

Here are the steps needed to connect.

1. first you have to determine what files are needed. Using a text editor, I opened the "snapshot.txt" file found in the folder where my php is installed. From that I determined, I had the following
php v. 5.3.3
Thread Safe "ts"
compiled with c++ v6

A good link to use to determine your configuration is this http://msdn.microsoft.com/en-us/library/cc296170.aspx

2. Since my web server is a different computer than my SQL server, I had to install SQL Server Native Client. For my setup I installed v 10. which I downloaded from
this link http://www.microsoft.com/en-us/downl...s.aspx?id=3522. Since I am running XP on my webserver I chose the "X86 Package (sqlncli.msi) - 4504 KB"

3. Next I needed to install the correct .dll php driver. From the data I gathered from the snapshot.txt file, I saw that I needed "SQLSRV20.EXE. Which I had figured out from this link http://php.net/manual/en/ref.pdo-sqlsrv.php, I scrolled down the page and clicked on the http://download.microsoft.com/downlo...1/SQLSRV20.EXElink.

4. When I ran SQLSRV20.EXE, I choose my /php/ext folder to extract all the .dll files. It also come with the appropriate API docs so you can read the appropriate syntax for your setup.

5. The last installation step needed was to include the right .dll file to be loaded into my php.ini file. I loaded both regular sqlservr and pdo by adding these lines in the .ini file
  • extension=php_sqlsrv_53_ts_vc6.dll
  • extension=php_pdo_sqlsrv_53_ts_vc6.dll
So I could choose the syntax that suited me best.

6. Then it was just a matter of reading API docs to write the correct connection script.

7 3994
Dormilich
8,658 Expert Mod 8TB
I would recommend PDO with the ODBC driver.
Jun 12 '12 #2
omerbutt
638 512MB
you are having issues because you need to look in the TS(thread safe) AND NON TS(non thread safe) DLL files for sqlsrv only one particular link wont help you u need to install all these diferent types and try them one by one as all the dll are compiled differently for different versions of php i had a project of DOC - > IMAGE conversion where it has to use the IMAGICK OPENOFFICE AND SQLSRV ALONG WITH PHP TO MAINTAIN LOGS AND RECORDS, i had php version 5.2.3 , i would recommend you to use that verson if there is not any specific / strict requirement for the project

REGARDS,
Omer Aslam
Jun 14 '12 #3
omerbutt
638 512MB
look here , i think it is negating wot u said php 5.3 is supported, DORMILICH GUIDED you the right way, follow the links that it has included
HERE
Jun 14 '12 #4
Claus Mygind
571 512MB
Thank you both for your answers. I have done some further checking and I see I need the following.

1) Install SQL Native Client on my Apache Web Server machine, I believe that must be on the CD that came with MS SQL server which we have installed on another machine.

2) My version of php is 5.3.3 which seems to fall right between the cracks. Looking at snapshot.txt in the php folder, I see my version is compiled with V6, So I must select those .dll files to install.

3) Also I see that my php5ts.dll so I have to select the

php_sqlsrv_53_ts_vc6.dll and php_sqlsrv_53_ts.dll

or

php_pdo_sqlsrv_53_ts_vc6.dll and php_pdo_sqlsrv_53_ts.dll

I think I have to get my files from SQLSRV20.EXE as it is compiled with C++ v6 and not the SQLSRV30.EXE which I believe is compiled with C++ v9

I will do further review on the links you have provided.

So my question is this. Do I load both the php_pdo_sqlsrv_53_ts_vc6.dll and php_pdo_sqlsrv_53_ts.dll in my php.ini file?
Jun 14 '12 #5
Dormilich
8,658 Expert Mod 8TB
haven’t had to use PDO with SQL server yet, but I can point you to the PDO SQL Server Driver page: http://www.php.net/manual/en/ref.pdo-sqlsrv.php
Jun 14 '12 #6
Claus Mygind
571 512MB
Thanks, I been there. And when you read the installation instructions, you can see why I say my installation of php v 5.3.3 falls between the cracks.

When I look in the snapshot.txt file found in the folder where my php.exe is installed, I see this

Version: 5.3.3
Branch: HEAD
Build: D:\php-sdk\snap_5_3\vc6\x86\obj\Release_TS

That tells me I need to download SQLSRV20.EXE Because I need the .dll files compiled with c++ 6.

Again the installation instructions are not clear about which files to install. There are 3 relevant files in the bunch.

php_pdo_sqlsrv_53_ts.dll
php_pdo_sqlsrv_53_ts_vc6.dll
php_pdo_sqlsrv_53_ts_vc9.dll

From this I take it to mean that I at least need the.
php_pdo_sqlsrv_53_ts_vc6.dll

But I also need to install Microsoft SQL Server 2008 R2 Native Client.

Thanks again for all the help.
Jun 15 '12 #7
Claus Mygind
571 512MB
Thanks to the help here, I was able to install the right "SQL Server Native Client" and the correct php SQL .dll file on my Apache Web Server so I can now use php script to access data on our SQL Server in addition to our MySQL server.

Because there are different versions of php and SQL servers. I am only going to describe my steps, but instructions on how to properly install for other configurations can be gleaned from the links provide here.

Here are the steps needed to connect.

1. first you have to determine what files are needed. Using a text editor, I opened the "snapshot.txt" file found in the folder where my php is installed. From that I determined, I had the following
php v. 5.3.3
Thread Safe "ts"
compiled with c++ v6

A good link to use to determine your configuration is this http://msdn.microsoft.com/en-us/library/cc296170.aspx

2. Since my web server is a different computer than my SQL server, I had to install SQL Server Native Client. For my setup I installed v 10. which I downloaded from
this link http://www.microsoft.com/en-us/downl...s.aspx?id=3522. Since I am running XP on my webserver I chose the "X86 Package (sqlncli.msi) - 4504 KB"

3. Next I needed to install the correct .dll php driver. From the data I gathered from the snapshot.txt file, I saw that I needed "SQLSRV20.EXE. Which I had figured out from this link http://php.net/manual/en/ref.pdo-sqlsrv.php, I scrolled down the page and clicked on the http://download.microsoft.com/downlo...1/SQLSRV20.EXElink.

4. When I ran SQLSRV20.EXE, I choose my /php/ext folder to extract all the .dll files. It also come with the appropriate API docs so you can read the appropriate syntax for your setup.

5. The last installation step needed was to include the right .dll file to be loaded into my php.ini file. I loaded both regular sqlservr and pdo by adding these lines in the .ini file
  • extension=php_sqlsrv_53_ts_vc6.dll
  • extension=php_pdo_sqlsrv_53_ts_vc6.dll
So I could choose the syntax that suited me best.

6. Then it was just a matter of reading API docs to write the correct connection script.
Jun 18 '12 #8

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: theintrepidfox | last post by:
Dear Group. Wondered if any of you has any suggestion for the following? Trying to install SQL Server 2005 Eval on a 'clean' machine. Well, my mistake was probably that I had installed Visual...
0
by: doron.almog | last post by:
anybody know which driver to use to make a linked server connection between MSSQL 2005 and Access 2007
0
by: Derftics | last post by:
Hi Guys, Is there anyone who have tried installing MSSQL 2000 and MSSQL 2005 servers in one desktop computer? I have tried using MSDE and successfully install the MSSQL 2000 server but when I...
0
by: ckiraly | last post by:
Greetings everyone - I am new to MSSQL 2005, and have started a database design project for my company. The issue I have is in a specific instance of foreign key creation. Here is the whole...
1
by: PeerGrid | last post by:
We have a membership web site that is heavily database driven using MSSQL 2000. We are looking at converting to MSSQL 2005. What is the level of pain in doing this? Will all database calls have to be...
3
by: Robert Johnson | last post by:
Hi all. My datasource is a MSSQL 2005 database with several tables all visable in my datasources tab. I can preview data in the Designer OK so my connection is fine. Now, I add a form, drag from...
0
by: Derftics | last post by:
Hi Guys, Anyone knows how to script all the users with permission and access level to an object in MSSQL 2005? In MSSQL 2000 you can use the scripting in EM just go to the option "script...
0
by: 123bargains | last post by:
Hello, I have a question on importing a database from MSSQL 2000 to MSSQL 2005. I hope someone on here can help me answer it. I am trying to import a database from MSSQL 2000 to 2005. But, when I...
3
by: mazdotnet | last post by:
Hi guys, I'm thinking of buying a laptop time this time and I was wondering if anyone has any experience with running VisualStudio 2008 and MSSQL 2005 on a laptop? Please include your processor,...
1
by: mmf.stavelot | last post by:
How to find out what type of the data procedure in MSSQL 2005 returns? Using inquiry about sample. Example: SELECT paramtypes FROM sysprocedures; Result:
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.