Jump to content

How to connect php with Sql Server 2005


ankit.pandeyc012

Recommended Posts

Hi friends...

I am using Wamp with PHP 5.3 and want to connect with SQL Server 2005 but not successful. I also tried it with PHP 5.2.8 but it still not working.

I google it and found some solutions but not successsful yet.

Can anyone give me detailed guide (step by step) that how i can connect PHP with Sql Server 2005???

Thanks in advance...

Link to comment
Share on other sites

afther a good read on the net for you.

 

works on 2005 aswell

 

Apache 2.2.14 /PHP 5.2.12/MS-SQL 2008 integration

 

    * Download Apache 2.2.14 for Windows Installer package 2008 32 bit httpd DOT apache DOT org/download.cgi --> apache_2.2.14-win32-x86-no_ssl

    * follow the defaults when installing Apache

    *

 

      stop Apache 2.2 service

    *

 

      Download PHP 5.2.12 Windows Zip package for Windows 2008 32 bit; (VC6 Thread Safe version needed for PHP used as an Apache module).

 

windows DOT php DOT net/download/ --> php-5.2.12-Win32-VC6-x86.zip - Extract the archive to C:\PHP - Verify the installation: C:\PHP>php -v

- set the Environment Variable PHPRC=C:\PHP - Rename 'C:\PHP\php.ini-recommended' to 'C:\PHP\php.ini' - Edit C:\PHP\php,ini file:

 

modify:    extension_dir = "C:\PHP\ext"

uncomment:  extension=php_mssql.dll

 

    *

 

      Add the lines below to "C:\Program Files\Apache Software Foundation\Apache2.2\conf\httpd.conf"

 

      PHPIniDir "C:/PHP/"

      LoadModule php5_module "C:/PHP/php5apache2_2.dll"

      AddHandler application/x-httpd-php .php

 

    *

 

      Add the lines below to "C:\Program Files\Apache Software Foundation\Apache2.2\conf\mime.types"

 

      application/x-httpd-php php

      application/x-httpd-php-source  phps

 

    *

 

      Ensure that phpinfo.php file with the content: is in the folder C:\Program Files\Apache Software Foundation\Apache2.2\htdocs

    *

 

      Start Apache 2.2 service

    * Verification of Apache/PHP integration: http://localhost/phpinfo.php --> 'PHP Version 5.2.12' info shows up

    * Verification whether mssql' module is loaded: c:\php\php -m

 

All works like a charm ... no additional steps needed.

 

Link to comment
Share on other sites

afther a good read on the net for you.

Congratulations on reading everything except the bits where OP says he already has WAMP.

 

All works like a charm ... no additional steps needed.

Except for the additional steps needed to actually connect to SQL Server. Which, I believe, is the whole point of this thread.

 

 

ankit.pandeyc012:

Find the SQLSRV extension from Microsoft. They provide installation instructions.

Once installed, try a couple of the examples in the PHP manual.

Link to comment
Share on other sites

WAMP makes this SO NICE AND EASY!

 

Click on the little WAMP icon in the system tray.

Go to the PHP submenu

Go to the PHP extensions submenu

Check either/both php_mssql, php_pdo_mssql

 

The server will restart, with the extension enabled.

 

Use the mssql functions found in the PHP manual

http://php.net/manual/en/ref.mssql.php

 

Man, I love WAMP :D

 

 

Link to comment
Share on other sites

Use the mssql functions found in the PHP manual

http://php.net/manual/en/ref.mssql.php

The mssql extension is dead. The PHP team suggests SQLSRV.

This extension is not available anymore on Windows with PHP 5.3 or later.

 

SQLSRV, an alternative driver for MS SQL is available from Microsoft: » http://msdn.microsoft.com/en-us/sqlserver/ff657782.aspx.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.