Okay, let me be more specific in hopes of a response.

My database.php file contains the following class statement:

class DATABASE_CONFIG {

        var $default = array(
                'driver' => 'mysql',
                'persistent' => false,
                'host' => $_SERVER['NCGE_NEW_DB_HOST'],
                'login' => 'xxxxxxx',
                'password' => 'xxxxxxxxxx',
                'database' => 'xxxxxxx',
                'prefix' => '',
        );

        var $test = array(
                'driver' => 'mysql',
                'persistent' => false,
                'host' => 'localhost',
                'login' => 'user',
                'password' => 'password',
                'database' => 'test_database_name',
                'prefix' => '',
        );
}

Use of $_SERVER[['NCGE_NEW_DB_HOST'], which is set to "localhost",
produces the error:

Parse error: parse error, unexpected T_VARIABLE in /var/www/test/soc/
ncge/app/config/database.php on line 84

If I define the same $default array elsewhere in a test php program
and display it with a print_r function, it works fine.

Why do values from the $_SERVER array fail to resolve in this context
or is there an obvious syntax error in what I've specified?

On Jan 23, 10:04 am, bj204 <bobj...@gmail.com> wrote:
> When configuring database.php, is it possible to assign elements from
> the $_SERVER array (which I have set up to include login, password and
> database name values) to corresponding elements of the $default or
> $test arrays?
>
> If so, could someone please describe the syntax or other requirements
> for doing this properly.
>
> I have experimented with many different specifications, some of which
> work without giving syntax errors, but none so far have allowed me to
> connect to a database, whereas just including the actual strings works
> fine.
>
> Is doing something like this considered good database security
> practice in the CakePHP world, or are there other preferred ways of
> protecting database access information?  As may be obvious, I'm very
> new to this environment.
>
> Thanks in advance.

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en

Reply via email to