473,387 Members | 1,535 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,387 software developers and data experts.

connecting to SQL Server using PHP

Hello,

well, I am still trying to connect to SQL Server 2000 (MSDE) form PHP

I did the following:
1. enabled php_mssql.dll extension in php.ini (phpinfo() shows it)
2. every dll is in proper place (System32 or php folder and few more
folders just to be sure) including
ntwdblib.dll

I am running Apache, PHP 4.3.9 and MSDE on the same machine with Win2k

SQL server config.:
1. Two instances: default SERVER and SERVER\Portal
2. Both instances are using SQL auth mode, and user that I try to log
in has db admin rights

can't connect to any of the instances :(

I tried the following:
1. specyfing the port in mssql_connect ('SERVER\Portal,1433') DIDN'T
WORK
2. different notations 'SERVER\Portal' or 'SERVER\\Portal' DIDN'T WORK
3. different naming like: SERVER, localhost, 127.0.0.1 DIDN'T WORK

The ASP pages that are using the same sql server work fine :| so there
is a connection to the server for
ASP :]

So my question is what I did wrong?

and another question is: How to connect to a named instance of a sql
server if it isn't running on the
same machine with web server, what would be the connection string in
mssql_connect??????

Thanks for any advice

STEFAN

Jul 17 '05 #1
7 2734
Could you post any reply or errors from the PHP, so we can understand
more about the situation

Jul 17 '05 #2
sure thing, here it is:

Warning: mssql_connect(): Unable to connect to server: SERVER\Portal
....... on line 5

on line 5 there is:
$db_connect = mssql_connect('SERVER\Portal', 'sa', 'my_passwd');

Jul 17 '05 #3
maybe mssql_connect('127.0.0.1:1443','sa','my_passwd') would work for
you, replace 127.0.0.1 with you server network name or IP

Jul 17 '05 #4
didn't work :(
moreover: I switched off my firewall and I still can't connect

Jul 17 '05 #5
I have bumped to this also, only thing that worked for
me was to use odbc calls.

The problem seems to be related to instances, if you don't have them
and use default server then mssql functions work with sql server 2000.

If there is a renamed instance (even if only one is running)
I could not connect. The server does not listen on the default port
but on something else.
Jul 17 '05 #6
OK I solved my problem

Here is the routine:

I needed Server Network Utility tool in order to enable TCP/IP for the
instance that I want connect to. After I enabled it, the php connection
works fine.

Thanks for each answer

STEFAN

Jul 17 '05 #7
"stefanPL" <st******@poczta.onet.pl> wrote in message
news:11*********************@c13g2000cwb.googlegro ups.com...
Hello,

well, I am still trying to connect to SQL Server 2000 (MSDE) form PHP

I did the following:
1. enabled php_mssql.dll extension in php.ini (phpinfo() shows it)
2. every dll is in proper place (System32 or php folder and few more
folders just to be sure) including
ntwdblib.dll

I am running Apache, PHP 4.3.9 and MSDE on the same machine with Win2k

SQL server config.:
1. Two instances: default SERVER and SERVER\Portal
2. Both instances are using SQL auth mode, and user that I try to log
in has db admin rights

can't connect to any of the instances :(

I tried the following:
1. specyfing the port in mssql_connect ('SERVER\Portal,1433') DIDN'T
WORK
2. different notations 'SERVER\Portal' or 'SERVER\\Portal' DIDN'T WORK
3. different naming like: SERVER, localhost, 127.0.0.1 DIDN'T WORK

The ASP pages that are using the same sql server work fine :| so there
is a connection to the server for
ASP :]

So my question is what I did wrong?

and another question is: How to connect to a named instance of a sql
server if it isn't running on the
same machine with web server, what would be the connection string in
mssql_connect??????

Thanks for any advice

STEFAN


A wild guess: maybe the MSSQL client library in PHP doesn't support
connecting a named instance? The library is for SQL Server 7, if I remember
correctly.
Jul 17 '05 #8

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Google Mike | last post by:
After a lot of thought and research, and playing with FreeTDS and InlineTDS, as well as various ODBC connections, I have determined that the fastest and cheapest way to get up and going with PHP on...
2
by: Ramir Santos | last post by:
my analysis server is hosted on a win2k server with IIS, the hosting page is on another machine. I have followed everything as per MS KB article and I could not connect through the analysis server...
4
by: John Morgan | last post by:
I have Enterprise Manager on my local machine. For the last twelve months it has been connecting without problem to my online SQL Server database provided by my ISP. Three weeks ago the ISP...
4
by: CodeImp | last post by:
A simple app I quickly wrote to try getting info from a database. Here is the first part of its code. The rest of the code is irellevant. using System; using System.Data; using...
12
by: Ann Marinas | last post by:
Hi all, I would like to ask for some help regarding separating the asp.net webserver and the sql server. I have created an asp.net application for a certain company. Initially, we installed...
3
by: Vinod R.Shenoy | last post by:
Hi All, Came across a post wherin you had helped somebody with a similar problem and was wondering if you could help us out with it. Our problem is , We have a development SQL Server 2000...
6
by: Todd Brewer | last post by:
Windows Server 2000 ASP.NET 2.0 SQL Server 2000 (on a physically seperate server) I moved an ASP.NET 2.0 application from a development server to production, and am getting the following error:...
0
by: athindrans | last post by:
hi everyone first time using sql server. I have problem connecting from a small c++ program in visual c++ express editon to sqlserver 2005 developer editon. It says error connecting to...
2
by: samadams_2006 | last post by:
Hello, I have a problem that I'm hoping someone will be able to help me resolve. 1) I have a C# Web Site in which I connect to the database: "Install Microsoft SQL Server 2005 Express...
2
by: orandov | last post by:
Hi, I am having a problem connecting my .net applications from the application server to the database server. When I run the application from my windows xp (sp2) box it works fine. When I try to...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
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
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,...

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.