I always feel that personal blog is a bright place in the establishment, and here can also record their own content, today I just set up a free time, using the template of WordPress home. However, you need to configure the Apache and PHP and mysql environments. So let’s record my creation process

wordpres : /var/www/html

httpd: /etc/httpd/conf

Install the Apache HTTPD service

Installing Apache HTTPD requires commands to install it

sudo yum install httpd

The root user does not need sudo. You need to boot it up after installation

Service start HTTPD or systemctl start httpd.service

After starting, you can check the status first

service httpd status

If you see the red line marked “active”, enter IP in the browser to access it. If Apache appears, it says Testing 123… That means the first step has been taken

However, if IP access is not available, you need to configure it again. I use Ali cloud, so I need to go to Ali cloud to configure port 80. Because ali cloud does not open port 80 by default. Login ali cloud management control platform, find our IP instance, and then modify the security group configuration. I won’t repeat it here. Please refer to https://www.cnblogs.com/klmei/p/7055571.html after opening the port 80, will be no problem.

Mysql installation

Mysql installation will not be described, this is done before, the subsequent installation of mysql when the supplement here. After connecting to the database through Navicat, I created a new database just for WordPress. I’ll just call it WordPress. High recognition.

Configuring the PHP environment

Go straight to order

yum install php yum install php-mysql yum install php-gd php-imap php-ldap php-odbc php-pear php-xml php-xmlrpc

Go to /var/www/html, create a PHP file called info.php, and write PHP code in it.

vi info.php


      
phpinfo();
? >
Copy the code

This code is used to view PHP information, through the IP +info.php form to access. When I went to the address, I found that the browser printed out the code for me, which obviously did not show me PHP information. That means there is a problem.

Go to the Apache directory. Vim httpd.conf, Apache path at the top of the article. Step 1, find ServerAdmin, change the following to root@localhost step 2, AddType application/ x-compresse. Z,AddType Application/x-gz.gz. TGZ,AddType Application/x-gz.gz. TGZ,AddType Application/x-gz.gz. TGZ

AddType application/x-httpd-php-source .php

AddType application/x-httpd-php .php

If you go to info.php, the PHP information will be displayed, indicating that this step has succeeded.

Download wordpress

I downloaded it from the official website and uploaded it to the server through FTP tool. I’m not going to do that

Put the tar.gz package in /var/www/html and unzip it. WordPress is half done. Then through THE IP + wordpress form access, you can go up, but there is a problem. It tells me that WordPress5.2.2 must be php5.6 or higher to access, so I need to upgrade PHP again. On command

Yum Provides PHP # with only version 5.4

The RPM – Uvh mirror.webtatic.com/yum/el7/epe… # update source

The RPM – Uvh mirror.webtatic.com/yum/el7/web…

# yum remove php-common # yum remove php-common # yum remove php-common

yum install -y php56w php56w-opcache php56w-xml php56w-mcrypt php56w-gd php56w-devel php56w-mysql php56w-intl Php56w-mbstring # Install dependency packages

Version of PHP -v # changed to 5.6

Once you’re done, WordPress is ready to access. Set the host address, mysql library name, user name and password as instructed to proceed to the next step. WordPress does not have permission to create wp-config.php. This file is actually the WordPress configuration file, more core, and the time to download WordPress is not there. Create it in /var/www/html/wordpress

Once you’ve created it paste in the code it provides us and refresh the browser. With respect to ok.

Theme installation

You can install it online or download and upload it. I’m using an online installation here. But there was a problem with the installation, and WordPress told me: Unable to create directory wp-content/uploads/2019/08. Is its parent directory writable by the server? To perform the requested action, WordPress needs to access your web server.

Wp-config.php needs to be configured again. You only need to add one line of configuration information

define(‘FS_METHOD’,’direct’);

After installing the theme and activating it, we can refresh the browser to access the new theme.

Set up Chinese

Download patches in Chinese: wordpress – 5.2.2 – zh_CN. Zip then in/var/WWW/HTML/wordpress/wp – the content/languages under decompression, it’ll be ok. If you don’t have languages, build one

Apache command

Start, stop, and restart are all concurrent commands.

service httpd stop | start | restart

systemctl restart | start | stop httpd.service

httpd -k stop | start | restart | graceful

Apachectl stop | start | restart | graceful restart HTTPD service production environment, it is recommended to use apachectl command, use the graceful option

Resolve the 2M limit for uploading images

There is a file called info.php that comes in handy. First go to info.php in your browser

Then go to the red box and edit php.ini on the server. The Loaded Configuration File corresponds to the ini path.

Modify three parameters in the php.ini file

upload_max_filesize = 64M

post_max_size = 64M

max_execution_time = 30

Baidu says to restart the PHP service,

Systemctl restart php-fpm systemctl restart php-fpm

No matter, restarting the HTTPD service also works.

reference

Blog.51cto.com/itwish/2160… Apache command blog.csdn.net/qq_35723367… Build WordPress on centos

Blog.csdn.net/yuanrao/art… Update PHP on centos