We help IT Professionals succeed at work.

PHP SQLSERVER2008 CONFIGURATION

37 Views
Last Modified: 2016-05-22
I want to configure php to connect with sqlserver 2008 enterprise r2 .

i want to know each step by step details how to connect it.

i tried to install sql driver for php. but nothing working . really require your help as am new to php

thanks
Comment
Watch Question

Dave BaldwinFixer of Problems
CERTIFIED EXPERT
Most Valuable Expert 2014

Commented:
Is PHP running in a web server on the same machine as the SQL Server or is it on a different machine?  If it is on a different machine, then you need to install SQL Native Client because the SQLSRV driver needs it to operate properly.  If it is on the same machine, it is already installed when you installed the SQL Server.

The demo codes on this page http://us3.php.net/manual/en/function.sqlsrv-connect.php work fine if you have it set up correctly.  You have to change some of the details to match your setup.

Author

Commented:
i have installed on same server and change port for php to 90 as it was conflicting with port
Dave BaldwinFixer of Problems
CERTIFIED EXPERT
Most Valuable Expert 2014

Commented:
"change port for php to 90" ??  What does that mean?  What did you install?

Author

Commented:
i have change listen 80 to listen 90 in php.ini file after  sqlserver installation as locolhost for wamp was not opening.  as searched thru net i found its coz of port and i had to chagne it to run php smoothly
Dave BaldwinFixer of Problems
CERTIFIED EXPERT
Most Valuable Expert 2014

Commented:
That doesn't make any sense.  PHP itself does not listen to a port but the Apache web server does.  Apache launches PHP when there is a request for a PHP file.

Which version of Windows are you running?  Do you also have IIS or Skype installed?  If you also have IIS installed, it will probably respond when you make a request to 'localhost' instead of Apache.

Author

Commented:
iis is installed and wamp is running @localhost:90  

but issue is how to connect sql server with php

i even tried to connect from another pc using sql native client

thanks
Dave BaldwinFixer of Problems
CERTIFIED EXPERT
Most Valuable Expert 2014

Commented:
Did you try the code examples in the link above?

Author

Commented:
I tired the above example
not working stilll

dont know whats is the issue
Dave BaldwinFixer of Problems
CERTIFIED EXPERT
Most Valuable Expert 2014

Commented:
Create a file called 'phpinfo.php' in your web root with the contents below.   Put it's url in your browser (http://localhost:90/phpinfo.php) and it should show a page containing a lot of info about your PHP installation.  Look for 'sqlsrv' in that listing and tell me if you find it.
<?php
// Show all information, defaults to INFO_ALL
phpinfo();
?>

Open in new window

http://us3.php.net/manual/en/function.phpinfo.php
Commented:
This one is on us!
(Get your first solution completely free - no credit card required)
UNLOCK SOLUTION
Unlock the solution to this question.
Join our community and discover your potential

Experts Exchange is the only place where you can interact directly with leading experts in the technology field. Become a member today and access the collective knowledge of thousands of technology experts.

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

OR

Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.