Config.php -
In PHP web development, a config.php file is a custom script used to store sensitive site-wide settings—most notably database credentials—so they can be easily managed in one place and included in other scripts. Core Purpose and Contents
But for 80% of PHP projects, a well-secured, well-structured config.php is still the right tool for the job.
- API keys for third-party services (e.g., social media, payment gateways)
- Client ID and client secret for OAuth-based services
- $config = [ ... ];
Global Paths: Defines absolute URLs or directory paths for assets like CSS, JavaScript, and file uploads. Basic Structure Example
<?php
/**
* Configuration file
*/
// Bad
include 'another_config.php';
If they could read it, they could steal the database password. They could download the entire history of the site, wipe it clean, or hold it for ransom.