基礎環境
安裝MySQL並配置好密碼
安裝apache,php
[root@localhost ~] yum -y install httpd php php-mysql
[root@localhost config]# php -v
PHP 5.4.16 (cli) (built: Oct 30 2018 19:30:51)
Zend Engine v2.4.0, Copyright (c) 1998-2013 Zend Technologies
[root@localhost config]# mysql -V
mysql Ver 14.14 Distrib 5.7.24, for Linux (x86_64) using EditLine wrapper
[root@localhost config]# httpd -V
Server version: Apache/2.4.6 (CentOS)
Server built: Nov 5 2018 01:47:09
[root@localhost config]# uname -a
Linux localhost.localdomain 3.10.0-957.el7.x86_64 #1 SMP Thu Nov 8 23:39:32 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux
解壓DVWA-master.zip,修正dvwa目錄權限
[root@localhost html]# pwd
/var/www/html
[root@localhost html]# unzip DVWA.zip
[root@localhost html]# ls
dvwa DVWA.zip
重命名
[root@localhost html]# cp config/config.inc.php.dist config/config.inc.php
[root@localhost html]# vi config/config.inc.php #修正mysql密碼等
[root@localhost html]# chown -R apache:apache dvwa
開啓防火牆通過80端口
關閉selinux(不然提示無法連接MySQL服務… Could not connect to the MySQL service. )
[root@localhost ~]# firewall-cmd --permanent --add-port=80/tcp
[root@localhost ~]# firewall-cmd --reload
[root@localhost ~]# vi /etc/sysconfig/selinux
SELINUX=enforcing #改爲 SELINUX=disabled
PHP 配置
vi /etc/php.ini
安裝php庫等
yum -y install php-gd php-fpm
yum -y install tree vim