所需要的程序包:httpd, php, php-mysql, mysql-server
        程序包都安装完成之后启动服务:
              service httpd start
              service mysqld start

 测试
    
               测试php程序与mysql通信
                    在用户的网站程序目录下编辑

         

           # vim /var/www/html/test.php                         <?php                              $conn = mysql_connect('HOST','USERNAME','PASSWORD');                              if ($conn)                                   echo "OK";                              else                                   echo "Failure";                              mysql_close();
         phpinfo();                         ?>


 编辑完成之后测试访问,如果可以下面我们进行安装WordPress及phpMyAdmin

http://www.phpmyadmin.net/  phpMyAdmin的获取地址

https://cn.wordpress.org/   WordPress的获取地址



[root@localhost tools]# ll
total 16588
-rw-r--r-- 1 root root 10057503 Sep 22 20:19 phpMyAdmin-4.4.14.1-all-languages.zip
-rw-r--r-- 1 root root  6922520 Sep 22 20:18 wordpress-4.3.1-zh_CN.tar.gz
[root@Lab6-1 tools]# tar xf wordpress-4.3.1-zh_CN.tar.gz  -C /var/www/html/
[root@Lab6-1 tools]# cd !$
cd /var/www/html/
[root@Lab6-1 html]# ls
wordpress
[root@localhost wordpress]# pwd
/var/www/html/wordpress
[root@localhost wordpress]# ls
readme.html      wp-blog-header.php    wp-content   wp-links-opml.php  wp-mail.php      wp-trackback.php
index.php    wp-activate.php  wp-comments-post.php  wp-cron.php  wp-load.php        wp-settings.php  xmlrpc.php
license.txt  wp-admin         wp-config-sample.php  wp-includes  wp-login.php       wp-signup.php
[root@localhost wordpress]# 
[root@localhost wordpress]# cp wp-config-sample.php wp-config.php// 此处需要改成wp-config.php 否则可能不识别
[root@localhost wordpress]# vim wp-config.php
<?php

/**

 

 * WordPress基础配置文件。

 *

 * 这个文件被安装程序用于自动生成wp-config.php配置文件,

 * 您可以不使用网站,您需要手动复制这个文件,

 * 并重命名为“wp-config.php”,然后填入相关信息。

 *

 * 本文件包含以下配置选项:

 *

 * * MySQL设置

 * * 密钥

 * * 数据库表名前缀

 * * ABSPATH

 *

 * @link https://codex.wordpress.org/zh-cn:%E7%BC%96%E8%BE%91_wp-config.php

 *

 * @package WordPress

 */

 

// ** MySQL 设置 具体信息来自您正在使用的主机 ** //

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

define('DB_NAME', 'wpdb');// 要使用的MySQL数据库名称

 

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

define('DB_USER', 'wpuser');// 登录数据库用户名

 

/** MySQL数据库密码 */// 登录数据库的密码

define('DB_PASSWORD', 'wppasswd');

 

/** MySQL主机 */

define('DB_HOST', 'localhost');

 

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

define('DB_CHARSET', 'utf8');

 

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

define('DB_COLLATE', '');

 

/**#@+

 * 身份认证密钥与盐。

 


 

[root@localhost html]# mysql
Welcome to the MariaDB monitor.  Commands end with ; or \g.
Your MariaDB connection id is 5
Server version: 5.5.41-MariaDB MariaDB Server
 
Copyright (c) 2000, 2014, Oracle, MariaDB Corporation Ab and others.
 
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
 
MariaDB [(none)]> GRANT ALL ON wpdb.* TO 'wpuser'@'localhost' IDENTIFIED BY 'wppasswd';
Query OK, 0 rows affected (0.00 sec)
 
MariaDB [(none)]> GRANT ALL ON wpdb.* TO 'wpuser'@'127.0.0.1' IDENTIFIED BY 'wppasswd';
Query OK, 0 rows affected (0.00 sec)
 // 创建用户wpuser的所有localhost和127.0.0.1登录模式及用户密码,并授权wpuser用户对wpdb数据库的权限
 
MariaDB [(none)]> CREATE DATABASE wpdb;// 创建wpdb数据库
Query OK, 1 row affected (0.00 sec)
 
MariaDB [(none)]> FLUSH PRIVILEGES;// 刷新授权
Query OK, 0 rows affected (0.00 sec)


 

打开浏览器
在地址栏输入:HTTP://IP/wordpress/install.php
这样会转到一个界面,填入必要的信息(网站名称,用户,密码,Email等),然后点击install就行了。

访问WordPress网站:
在地址栏输入:HTTP://IP/wordpress/
这样会自动执行index.php文件,然后就访问到自己的网站了。
至此,最简单的建立wordpress站点的过程描述完毕,我们可以在这个站点上面发布自己的文章了。


 

————————————分隔———————————————

————————————分隔———————————————

 

 

 

 

[root@localhost pma]# ls
browse_foreigners.php    error_report.php        server_binlog.php            tbl_find_replace.php
ChangeLog                examples                server_collations.php        tbl_get_field.php
changelog.php            export.php              server_databases.php         tbl_gis_visualization.php
chk_rel.php              favicon.ico             server_engines.php           tbl_import.php
composer.json            file_echo.php           server_export.php            tbl_indexes.php
config.sample.inc.php    gis_data_editor.php     server_import.php            tbl_operations.php
CONTRIBUTING.md          import.php              server_plugins.php           tbl_printview.php
db_central_columns.php   import_status.php       server_privileges.php        tbl_recent_favorite.php
db_create.php            index.php               server_replication.php       tbl_relation.php
db_datadict.php          js                      server_sql.php               tbl_replace.php
db_designer.php          libraries               server_status_advisor.php    tbl_row_action.php
db_events.php            LICENSE                 server_status_monitor.php    tbl_select.php
db_export.php            license.php             server_status.php            tbl_sql.php
db_import.php            locale                  server_status_processes.php  tbl_structure.php
db_operations.php        navigation.php          server_status_queries.php    tbl_tracking.php
db_printview.php         normalization.php       server_status_variables.php  tbl_triggers.php
db_qbe.php               phpinfo.php             server_user_groups.php       tbl_zoom_select.php
db_routines.php          phpmyadmin.css.php      server_variables.php         themes
db_search.php            phpunit.xml.hhvm        setup                        themes.php
db_sql_autocomplete.php  phpunit.xml.nocoverage  show_config_errors.php       transformation_overview.php
db_sql_format.php        prefs_forms.php         sql                          transformation_wrapper.php
db_sql.php               prefs_manage.php        sql.php                      url.php
db_structure.php         print.css               tbl_addfield.php             user_password.php
db_tracking.php          README                  tbl_change.php               version_check.php
db_triggers.php          RELEASE-DATE-4.4.11     tbl_chart.php                view_create.php
DCO                      robots.txt              tbl_create.php               view_operations.php
doc                      schema_export.php       tbl_export.php               webapp.php
[root@localhost pma]# cp config.sample.inc.php config.inc.php 
[root@localhost pma]# vim config.inc.php 
<?php
/* vim: set expandtab sw=4 ts=4 sts=4: */
/**
 * phpMyAdmin sample configuration, you can use it as base for
 * manual configuration. For easier setup you can use setup/
 *
 * All directives are explained in documentation in the doc/ folder
 * or at <http://docs.phpmyadmin.net/>.
 *
 * @package PhpMyAdmin
 */
 
/*
 * This is needed for cookie based authentication to encrypt password in
 * cookie
 */
$cfg['blowfish_secret'] = '9JbG+jbx2pxNq2OP5Oz586VYenz+TapyPB9OIIQw'; /* YOU MUST FILL IN THIS FOR COOKIE AUTH! */
 
/*
 * Servers configuration
 */
$i = 0;
 
/*
 * First server
 */
$i++;
/* Authentication type */
$cfg['Servers'][$i]['auth_type'] = 'cookie';
/* Server parameters */
$cfg['Servers'][$i]['host'] = 'localhost';
$cfg['Servers'][$i]['connect_type'] = 'tcp';
$cfg['Servers'][$i]['compress'] = false;
$cfg['Servers'][$i]['AllowNoPassword'] = false;

wKiom1YLaUTBPMW-AAD11NUMbjk734.jpg

[root@localhost pma]# yum install php-mbstring
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
Resolving Dependencies
--> Running transaction check
---> Package php-mbstring.x86_64 0:5.4.16-23.el7_0.3 will be installed
--> Finished Dependency Resolution
 
Dependencies Resolved
 
==============================================================================================================================
 Package                        Arch                     Version                                Repository               Size
==============================================================================================================================
Installing:
 php-mbstring                   x86_64                   5.4.16-23.el7_0.3                      local                   501 k
 
Transaction Summary
==============================================================================================================================
Install  1 Package
 
Total download size: 501 k
Installed size: 1.3 M
Is this ok [y/d/N]: y
Downloading packages:
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
  Installing : php-mbstring-5.4.16-23.el7_0.3.x86_64                                                                      1/1 
  Verifying  : php-mbstring-5.4.16-23.el7_0.3.x86_64                                                                      1/1 
 
Installed:
  php-mbstring.x86_64 0:5.4.16-23.el7_0.3                                                                                     
 
Complete!
[root@localhost pma]#

wKioL1YLaXKwzzpOAAFzJ8qlhtU153.jpg



这样我们的WordPress以及phpMyAdmin服务就全部安装完成了~~


完。