In which file is the php database password located?

(*-*)浩
Release: 2023-02-25 14:04:01
Original
7582 people have browsed it

The username and password of the database in PHP are generally written in a configuration file and placed in the root directory of the website, or in the include folder. Usually the file name is config.inc.php.

In which file is the php database password located?

Now almost all open source CMS and website systems, PHP type, database passwords are written in files similar to config.inc.php middle. You can watch (DEDECMS/phpcms/DISCUZ/thinkphp, etc.)

config.inc.php (Recommended learning: PHP video tutorial)

<?php
    $config=array(
        &#39;host&#39; =>&#39;localhost&#39;,
        &#39;port&#39;=>&#39;3306&#39;,
        &#39;db&#39; =>&#39;localhost&#39;,
        &#39;db_user&#39; =>&#39;root&#39;,
        &#39;db_psw&#39; =>&#39;&#39;,
        &#39;db_name&#39; =>&#39;test&#39;
    );
    $connID=@mysqli_connect($config[&#39;host&#39;],$config[&#39;db_user&#39;],$config[&#39;db_psw&#39;],$config[&#39;db_name&#39;],$config[&#39;port&#39;]);
    if(!$connID){
        echo("数据库连接失败");
    }
?>
Copy after login

Even if the user name and password of the MYSQL database are known to others and there is no remote connection permission, it is useless.

Unless you write the super administrator user permissions in the PHP file (generally only given to ordinary users with read and write permissions)

The rented space is separated using the virtual host management system. The permission distribution among N stations on a server is different and will not affect each other (if it does, it is because the administrator of this IDC service provider is too unqualified and basically does not do it).

Unless the entire server is taken down, in this case, the result will be the same no matter where you write it.

No matter where it is written, it is transparent to the IDC service provider administrator. If you want to see it, you can read it, and if you want to delete it, delete it, but generally do not touch it. This involves professional ethics and company reputation.

I used to manage a website for five years, with nearly 100,000 IP addresses every day, and there was no security issue due to the leakage of MYSQL user names and passwords.

The last point is also the most direct point: millions of webmasters, as long as they use PHP, are doing this, and few of them worry about this problem.

The above is the detailed content of In which file is the php database password located?. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
php
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!