If you need to inspect Magento’s configured database connection from code, you can load Magento and read the default_setup resource connection.
On Linux, a simple PHP file can look like this:
| |
In this example, /home/cliper/magento/ is the absolute path to the Magento installation.
On Windows, adjust the include path accordingly:
| |
After that, you can read individual values like this:
| |