Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7024467
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T23:50:36+00:00 2026-05-27T23:50:36+00:00

I got configuration file database.php <?php defined(‘_ENGINE’) or die(‘Access Denied’); return array ( ‘adapter’

  • 0

I got configuration file database.php

<?php defined('_ENGINE') or die('Access Denied'); return array (
  'adapter' => 'mysqli',
  'params' => 
  array (
    'host' => 'localhost',
    'username' => 'root',
    'password' => 'root',
    'dbname' => 'db',
    'charset' => 'UTF8',
    'adapterNamespace' => 'Zend_Db_Adapter',
  ),
  'isDefaultTableAdapter' => true,
  'tablePrefix' => 'engine4_',
  'tableAdapterClass' => 'Engine_Db_Table',
); ?>

How to get only password from this array?

something like echo $array['password'];

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T23:50:36+00:00Added an answer on May 27, 2026 at 11:50 pm

    How do I get the array from database.php?

    You’ll need to include the file and bind the returned value to a variable, such as in the below example.

    $db_conf = require ('/path/to/database.php');
    

    $db_conf will contain the data returned by database.php.

    Documentation

    • PHP: include – Manual

    How do I read the specific value from my array?

    Since you are working with a nested array the solution is not as far away as you might think. First use $a[key] to get to the array stored under params, and then get the value of password from there.

    As in the below example.

    $password = $array['params']['password'];
    

    Note: The above is, in a logical sense, equivalent to;

    $params   = $array['params'];
    $password = $params['password'];
    

    Documentation

    • PHP: Arrays – Manual

    I tried the above but it’s just shouting "Access Denied" in my face, why?

    To protect database.php from unintended access it has been protected with a check to see so that it’s being used inside of the engine.

    The script will die if _ENGINE is not defined.

    If you want to use database.php in a script outside of the thought of engine you’ll need to define the _ENGINE constant before includeing the file.

    define ('_ENGINE', 1);
    
    ...
    
    $db_conf = include ('database.php');
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I've got a configuration xml file that I need to parse for values before
I've got an xml configuration file with the following file formats: <FILE FILEFORMAT=|PREFIX|DATETIME|-|STRING|NUMBER|_|DATETIME2|-|TIME|SUFFIX| />
Has anyone got this configuration working? Latest Netbeans, latest Glassfish, I created an EJB
I've got to get a quick and dirty configuration editor up and running. The
I've got a program where a lot of classes have really complicated configuration requirements.
I've got a simple ASP.NET MVC website. It has Debug, Testing and Release configuration
I've got a problem with ProFTPD on Debian. I use users from MySQL database
PHP sessions work by default with my configuration, if I just go session_start() and
I do some PHP with Kohana 3 (IDE:Netbeans), and got excited about idea of
I have a simple web site that needs to connect to an access database

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.