One, foreword

Here is to build a personal blog system from wordpress source. Of course, many clouds already provide an online installation option, which is beyond the scope of this article.

Ii. WordPress

WordPress is a personal blog system, and gradually evolved into a content management system software, it is the use of PHP language and MySQL database development, users can support PHP and MySQL database server to use their own blog.

It’s one of many open source blogging systems and definitely a work of conscience. Hats off to the authors and contributors. This article mainly describes the installation from the wordpress source, of course, is to download it from the wordpress official website here. The download is a compressed package that we need to extract ourselves.

Install wordpress

1. Identify infrastructure

WordPress is just a personal blogging system, but it is also a server system. To install wordpress, you need to install the appropriate infrastructure, INCLUDING PHP, mysql, and Apache. But these are already installed on the Mac. All we need to do is execute the corresponding command line to see if the version matches.

Viewing the Apache Version

$ apachectl -version
Server version: Apache/2.4.34 (Unix)
Server built:   Feb 22 2019 19:30:04
Copy the code

New VERSION of PHP

$PHP -v PHP 7.1.23 (cli) (built: Feb 22 2019 22:08:13) (NTS) Copyright (c) 1997-2018 The PHP Group Zend Engine V3.1.0, Copyright (c) 1998-2018 Zend TechnologiesCopy the code

2. Configure and start related services

2.1 Starting the Apache Service

Start the Apache

$ sudo apachectl start
Copy the code

Close the Apache

$ sudo apachectl stop
Copy the code

Restart the Apache

$ sudo apachectl restart
Copy the code

2.2 use PHP

To start PHP, you need to modify the Apache configuration file in the terminal (of course, you can also find the path directly in the Finder and use the text editor to do so) :

sudo vim /etc/apache2/httpd.conf
Copy the code

Uncomment the following configuration to start PHP.

LoadModule php7_module libexec/apache2/libphp7.so
Copy the code

The result is shown below

2.3 Changing the Apache Directory

By default, Apache directory to/Library/WebServer/Documents, we certainly hope wordpress should work in their own directory. Suppose we have to face to download and extract the good wordpress copy directory to/Library/WebServer/Documents. DocumentRoot is configured in /etc/apache2/httpd.conf.

DocumentRoot "/Library/WebServer/Documents/wordpress"
<Directory "/Library/WebServer/Documents/wordpress">
    #
    # Possible values for the Options directive are "None", "All",
    # or any combination of:
    # Indexes Includes FollowSymLinks SymLinksifOwnerMatch ExecCGI MultiViews
    #
    # Note that "MultiViews" must be named *explicitly* --- "Options All"
    # doesn't give it to you.
    #
    # The Options directive is both complicated and important. Please see
    # http://httpd.apache.org/docs/2.4/mod/core.html#options
    # for more information.
    #
    Options FollowSymLinks Multiviews
    MultiviewsMatch Any

    #
    # AllowOverride controls what directives may be placed in .htaccess files.
    # It can be "All", "None", or any combination of the keywords:
    # AllowOverride FileInfo AuthConfig Limit
    #
    AllowOverride None

    #
    # Controls who can get stuff from this server.
    #
    Require all granted
</Directory>
Copy the code

As above, we are in the/Library/WebServer/Documents behind wordpress add their own directory. Then restart the Apache service.

apachectl restart
Copy the code

After the service is restarted, enter:

localhost
Copy the code

If the following page is displayed, the configuration is successful.

Notice that the response is actually

http://localhost/index.php
Copy the code

And it automatically jumps to /wp-admin/setup-config.php.

http://localhost/wp-admin/setup-config.php
Copy the code

2.4 open the Mysql

The figure above shows the Mysql service and related configuration required to install wordpress

Database name Database username Database password Database host Table prefix (if you want to run more than one WordPress in a single database)

Can't connect to local MySQL server through socket '/tmp/mysql.sock'(2)Copy the code

Check out Mysql

$mysql --version mysql Ver 14.14 Distrib 5.7.20,forOsx10.13 (x86_64) using EditLine wrapperCopy the code

But this is not the server of Mysql, this is the client. This is how we should see if the server is installed.

$ mysql -u root -p
Enter password: 
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 4
Server version: 5.7.27 MySQL Community Server (GPL)

Copyright (c) 2000, 2017, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type 'help; ' or '\h' for help. Type '\c' to clear the current input statement.

mysql> 

Copy the code

If you can’t access the Mysql console, you haven’t installed Mysql yet. If not, go to the Mysql website to download it. Download the free community edition to meet your needs. If it is already installed, use system Preferences to start the Mysql service. Of course, you need to start this service to access the Mysql console mentioned above.

Creating and configuring a database Creating a database is not going to be covered here, but let’s say we created a database called wordpress, which is empty. Then use plain text editing tools such as subline open before stored in the/Library/WebServer/Documents below wordpress/wp – config – sample. PHP. And modify the following content.

Database name Database username Database password Database host

Here’s an example:

// ** MySQL settings - You can get this info from your web host ** //
/** The name of the database for WordPress */
define( 'DB_NAME'.'wordpress' );

/** MySQL database username */
define( 'DB_USER'.'wordpress' );

/** MySQL database password */
define( 'DB_PASSWORD'.'wordpress123456' );

/** MySQL hostname */
define( 'DB_HOST'.'127.0.0.1: / var/run/mysqld/mysqld. The sock' );
Copy the code

DB_HOST = ‘localhost’; DB_HOST = ‘localhost’; Then save the modified file as wp-config.php. This completes the database configuration.

2.5 installation of WordPress

Front of a lot of long winded, finally ready to prepare the environment, then in the browser address bar input http://localhost/wp-admin/install.php, and then complete the installation according to the wizard can be done.

Four,

WordPress is a very good personal blogging system, and is open source, it is very conscience. In fact, the installation is very simple, summed up in: 1. Install PHP. 2. Install Mysql, of course, mainly on the server. Create an empty database, such as wordpress. 3. Install an HTTP server, such as Apache.

The article is very simple, I hope to give some help to students in need, thank you.