Re: [PHP-DB] mssql_connect error only on command line

[email protected] ("Molteni Davide")
Newsgroups php.db
Message-ID <[email protected]>
Hi,

thanks for your quick answer,

but in the script I don't use sessions variables to store host, user and
password, I wrote something like that:
$sc=mssql_connect("hostname,1433","userid","password");

Can you please tell me where I can find information about how to design
scripts for either the environment?

Thanks a lot.

Davide

2008/4/2, Krister Karlström <[email protected]>:
>
> Hi!
>
> That description did not help us very much... I think you're just
> connecting using the wrong credentials, or using no at all. From where do
> you grab the hostname, username and password? Maybe it's stored in your
> session or something, and that session is not working in your command line
> environment..? It could be just about anything that's your problem! :)
>
> My advice is to take a look att the parameters using to connect to the
> server, maybe echo them to stdout before doing your connect... It might be
> that they are not defined when running your script on command-line.
>
> In general, very few script are written in such a way that they work the
> same way in a webserver environment and on command line. You should design
> your scripts for either the environment.
>
> Greetings,
> Krister Karlström, Helsinki, Finland
>
> Molteni Davide wrote:
>
>  Hi,
> >
> > I have a problem with all my php scripts that use MS SQL Server, but
> > only
> > when I start them from the command line
> > I'm using Apache 2.2.4 with PHP 5.2.5 on a server Win2k3 with SP2, and
> > MS
> > SQL Server 2000 on another Win2k3 server.
> > If I run the same script using a webbrower as an internet page it works
> > fine,
> > but if I run it from the command line (c:\>php scipt.php) I will receive
> > messages like this:
> > "Warning: mssql_connect(): Unable to connect to server: servername,1433
> > in
> > c:\script.php on line #"
> > Can someone have an idea what could be the problem?
> > Can someone please help me?
> > What should I do to make it working?
> > Tanks a lot in advance.
> >
> > Davide
> >
> >


-- 
Davide Molteni
alla Stazione
6702 Claro
Tel. 091 630 1710
Nat. 076 381 3281
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.