WordPress Small Skills Big useful-wp-config.php tips

Source: Internet
Author: User
WordPress small Tricks big use-wp-config.php tips

If the functions.php file is the most important WordPress theme files, then for the entire WordPress, the most important will be what? It should be a wp-config.php file. Use it to configure the functionality of the database, improve performance, and improve the security of all WordPress-driven websites and blogs. This shows that the importance of this document is unusually important. So this article with you to share a few of the use of WordPress configuration skills is also very important, I hope you can learn it!

By default, the installation of WordPress does not have a wp-config.php file, but a sample file, called wp-config-sample.php. You need to create a real profile wp-config.php for your blog based on this sample file. Most people do not manually create this real profile, because the WordPress installation process allows you to automatically complete the process, this automatic creation process is actually added, modified the main WordPress configuration, therefore, Let's start by looking at what this auto-creation process does for you.

After uploading WordPress into the site via FTP, you will see the following page:

The English part means that you need a configuration file to work, you can create a configuration file through the Web interface (this is a sample), but this sample configuration file wp-config-sample.php not necessarily suitable for all hosts. If you are using a host that is currently very popular, it will work. The next step will be this:

Enter some key information there, and with this information WordPress can connect to the database. All information entered here will also be added to your profile wp-config.php:

Define (' db_name ', ' database-name ');
Define (' Db_user ', ' database-username ');
Define (' Db_password ', ' Database-password ');
Define (' db_host ', ' localhost ');

By default, the host of the database is localhost, because it applies to most hosts. However, there are some hosts that are configured differently, so you'll need to modify them if you use the following host:

??? 1and1 hosting-db12345678
??? Dreamhost-mysql.example.com
??? Godaddy-h41mysql52.secureserver.net
??? Icdsoft-localhost:/tmp/mysql5.sock
??? MediaTemple (GS)-internal-db.s44441.gridserver.com
??? Pair networks-dbnnnx.pair.com
??? Yahoo-mysql

Digging into WordPress e-book has talked about one of the coolest wp-config.php configuration tricks, through which you can detect the host of the database, the code is as follows:

Define (' Db_host ', $_env{database_server});

Paste the above code, it is likely to be able to master your database server, but then, of course, you need to manually edit the wp-config.php configuration file.

  • Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.