In the last tutorial, we have prepared the running environment required by the WordPress program on the local computer. Again, the real online release will be introduced in a set of special courses in the future. Therefore, we will continue to rely on this local environment for installation. In addition, we will manually edit the configuration file to install. As for the reasons and advantages, I will explain them in the following content. All right, let's get started!
1、 Download WordPress
First of all, you can download English or Chinese websites on the official website of WordPress. But considering the operating habits of most people, we choose to download them on Chinese websites. Open the official website, click "Get WordPress" on the top right corner of the home page, and then find the "Download WordPress" button on the page to download. Note: Do not select ". tar. gz" for local environment installation. Of course, if you need to download a specific historical version, you can also click "All Releases" on the page to download it.
2、 Manually Edit Profile
After the installation package is downloaded, generally many tutorials are directly deployed to the site directory and operated step by step according to the WordPress graphical installation wizard. Relevant configurations are carried out in the visual interface, which is also an officially recognized method of WordPress. However, the official also provided another installation method of manually editing the configuration file. Some people may say that since the first method is simpler, why introduce the second method?
This involves the authority and security issues in the production environment. Because if you install using the first method, you need PHP to have write permission to the root directory of the website. However, for the sake of site security in the production environment, you need to turn off PHP's write permission to the root directory of the website again after the installation is completed (only the write permission to individual directories is reserved). If you forget to modify it, you will leave a security risk. The installation method of manually editing files does not require PHP to have write permission to the root directory of the website. It can be authorized at one time without having to modify back and forth. The process is simpler and the probability of errors is reduced. (We will have a special tutorial on Linux empowerment.) So, in order to be closer to the production environment, we will introduce the installation method of manually editing the configuration file.
First, unzip the downloaded installation package to any folder on the local computer, find a file called "wp config sample. php", copy it and rename it "wp config. php".
Then, open the "wp-config.php" file with a code editor, find "define (DBNAME, databasenamehere)", and change the "databasenamehere" to the database name you created in advance; Find the "define (DBUSER, usernamehere)" and change the "usernamehere" to the database user name you created in advance; Find the "define (DBPASSWORD, password here)", change the "password here" to the password you set in advance, and then save the file. (See the previous tutorial for database creation and configuration)
3、 Deploy the edited installation package to the site directory
If it is an online environment, we generally need to compress and package the folder containing wp-config.php again, and then upload it to the directory of the specified site for decompression. Since we are now operating in the local environment, we can directly copy the contents of the entire folder to the site directory. However, since the copying speed of multiple small files is relatively slow, we recommend compressing them first, copying them, and then decompressing them. After completion, the structure of the site directory is shown in the following figure.
4、 Fill in the basic information of the site
Now, you can enter the site link in the browser. In PhpStudy, if the site file is directly placed in the "WWW" directory, the browser can access "localhost"; If you have created a subdirectory, just access "localhost/directory". Then, the browser will automatically jump to "localhost/directory/wp admin/install. php", fill in the "site title", "user name", "password" and "your e-mail address" to be created in the open page, and then click "Install WordPress". Note that the "user name" and "password" here are to create an administrator and password for the site, not the same as the previous database user name and password.
5、 Log in to the management background
After the installation is successful, click "Login" in the jump page. In the future learning process, please remember that the login link in the background of the WordPress site is "localhost/directory/wp login. php". Of course, you can also access "localhost/directory/wp admin". If you do not log in, you will automatically jump to the login link.
Well, the above is the whole process of installing the WordPress site in the local environment, and we also adopted the method of manually editing the configuration file. Next, we will officially start the journey of using WordPress. Where do you start? I think it is appropriate to start with the theme. Because after we are familiar with the installation and switching of themes, we can select and install a theme suitable for our own project among thousands of themes. In this way, all future operations and designs will be based on this theme, and the style will be relatively fixed. So, in the next tutorial, we will introduce WordPress Theme Please do not miss the operations related to.
Welcome to join us!