Re: Shell Script error

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



* Rui Francisco <rui.francisco@xxxxxxx>:
>
> Its a simple script
>
> $_SERVER['utilizador']='user';
> $_SERVER['pass']='pass';
> $_SERVER['host']='localhost or IP address';
> $_SERVER['db_name']='c:/path/dbname.fdb';

Why are you using the $_SERVER array? This is supposed to provide
information regarding the web server environment, such as headers,
script and path locations, and other items in the CGI specifications; it
shouldn't be used for storing application data.

In addition, it may or may not be available on the command line, which
could be causing the issue you're seeing.

If you simply need a global array... set up an array and then initialize
it in your functions/classes using the global keyword. Alternately,
$_ENV might be a better place to store this information.

>
> include_once('DB.php');
>
> $dsn="ibase://".$_SERVER['utilizador'].":".$_SERVER['pass']."@".$_SERVER['host']."/".$_SERVER['db_name'];
>
>     $ligacaoBD=DB::connect($dsn);
>     if (DB::isError($ligacaoBD)) {
>         die($ligacaoBD->getMessage());
>     }
>
> The user has admin right on the database, and the database doesn't 
> implement security measures like Mysql for access from other hosts.
>
> The problem is that if i run the script on the browser it works, but on 
> the command line on Windows machine it doesn't work
> > well maybe you are trying to connect to localhost which could be fine
> > for the server but not from commandline... send more info.
> >
> > Rui Francisco <rui.francisco@xxxxxxx> 11/10/2004 2:06:09 PM >>>
> > > Hi,
> > > 
> > > I have a small problem with a PHP script with Pear DB
> > > 
> > > The problem is the following: I'm creating a shell script in  PHP that
> > > access one interbase database.
> > > 
> > > The problem is that if i run it on a webserver the script run
> > > correctly
> > > but if i runit in the command line it reports one error (DB Error:
> > > connect failed).

-- 
Matthew Weier O'Phinney           | mailto:matthew@xxxxxxxxxx
Webmaster and IT Specialist       | http://www.garden.org
National Gardening Association    | http://www.kidsgardening.com
802-863-5251 x156                 | http://nationalgardenmonth.org

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux