第十一周

169 阅读2分钟

1、编译安装搭建wordpress

[root@localhost ~]# yum -y install php php-mysql php-fpm httpd MariaDB-server ##安装相关程序及组件

[root@localhost ~]# mv /etc/httpd/conf.d/welcome.conf{,.bak}

[root@localhost ~]# systemctl start httpd

[root@localhost ~]# systemctl enable httpd

[root@localhost ~]# systemctl start mariadb

[root@localhost ~]# systemctl enable mariadb

[root@localhost ~]# vim /var/www/html/info.php

<?php

echo date("Y/m/d");

phpinfo();

?>

[root@localhost ~]# vim /var/www/html/php-mysql.php

<?php

$connect = mysql_connect( '127.0.0.1','root','' );

if ( $connect )

echo "OK";

else

echo "Failure";

?>

[root@localhost ~]# systemctl restart httpd

[root@localhost ~]# setenforce 0 ##关闭selinux

在浏览器中测试:

http://127.0.0.1/info.php ##测试php与apache连接是否成功


http://127.0.0.1/php-mysql.php ##测试php与mariadb连接是否成功


[root@localhost ouyang]# mysql

MariaDB [(none)]> create database wordpress ##创建wordpress数据库

MariaDB [(none)]> grant all on wordpress.* to 'wproot'@'%' identified by 'wp123456'; ##创建对应的用户名及密码

[root@localhost ~]# vim /etc/my.cnf

[mysqld]

skip_name_resolve=ON

innodb_file_per_table=ON

[root@localhost ~]# systemctl restart mariadb

[root@localhost ouyang]# mysql -uwproot -p ##用新生成的用户登入看是否可以正常登入

[root@localhost ~]# wget https://cn.wordpress.org/latest-zh_CN.tar.gz ##下载wordpress程序

[root@localhost ~]# tar -zxf latest-zh_CN.tar.gz

[root@localhost ~]# cp -a ./wordpress/ /var/www/html/blog/ ##将文件复制到对应位置

[root@localhost ~]# cp /var/www/html/blog/wp-config-sample.php /var/www/html/blog/wp-config.php ##重命名配置文件,原本的配置文件权限太小

[root@localhost ~]# vim /var/www/html/blog/wp-config.php ##修改配置文件设置

/** WordPress数据库的名称 */

define('DB_NAME', 'wordpress');

/** MySQL数据库用户名 */

define('DB_USER', 'wproot');

/** MySQL数据库密码 */

define('DB_PASSWORD', 'wp123456');

/** MySQL主机 */

define('DB_HOST', '192.168.1.26');

/** 创建数据表时默认的文字编码 */

define('DB_CHARSET', 'utf8');

/** 数据库整理类型。如不确定请勿更改 */

define('DB_COLLATE', '');

http://127.0.0.1/blog/wp-admin/setup-config.php








2、搭建php-admin

php,mariadb借用上题环境

[root@localhost ouyang]# yum -y install php-mbstring

[root@localhost ouyang]# systemctl restart httpd

[root@localhost ~]# tar -xvf phpMyAdmin-4.0.10.20-all-languages.tar.gz

[root@localhost ~]# cp -a ./phpMyAdmin-4.0.10.20-all-languages/ /var/www/html/phpadmin/

[root@localhost ~]# cp /var/www/html/phpadmin/config.sample.inc.php /var/www/html/phpadmin/config.inc.php

在浏览器输入:http://127.0.0.1/phpadmin/index.php


                                                          登入界面

                                                         登入后界面