DVWA installation, ALMP environment setup, php version conversion, dvwaalmp
Preface
This document records the installation and configuration of DVWA (Damn Vulberability Web App) in virtual machines, including the establishment of the ALMP environment and the conversion of php versions.
Directory
2. Build an ALMP Environment
3. php version Switch
1. install and configure DVWA
1. Set up a virtual machine, set the Virtual Machine network to the bridging mode (Bridged), and use ifconfig-a to check the Virtual Machine ip address.
Reference: DVWA tutorial and DVWA installation tutorial
2. Build an Apache + PHP + Mysql environment.
Ii. ALMP Environment Construction
1. Install apache2
Sudo apt-get install apache2sudo/etc/init. d/apache2 restart // command restart
Enter http: // localhost or http: // 127.0.0.1 in the browser. If It works is displayed !, It indicates that Apache is successfully installed.
The default installation directory of Apache is/var/www/html.
2. install php:
sudo apt-get install libapache2-mod-php5 php5
Create the test. PHP file in/var/www/html to test whether PHP can run normally:
<?php echo "hello,world!!"?>
Restart apache
sudo /etc/init.d/apache2 restart
Enter http: // 127.0.0.1/test. php In the browser. If hello, world !!, It indicates that PHP runs normally.
3. Install the mysql database:
sudo apt-get install mysql-server mysql-client
4. Install phpmyadmin-Mysql Database Management
sudo apt-get install phpmyadmin
Phpmyadmin settings:
During installation, You must select Web server: apache2 or lighttpd, use the space key to select apache2, press the tab key, and then click OK.
Connect phpmyadmin to apache2:
sudo ln -s /usr/share/phpmyadmin /var/www/html
Phpmyadmin test: Open http: // localhost/phpmyadmin in the address bar of the browser.
5. Set the Ubuntu File Read and Write Permissions
After LAMP is set up and installed, the server root directory is set to/var/www/html by default.
Modify the read/write permissions of the/var/www/html directory
sudo chmod 777 /var/www/html
Reference: ALMP environment setup
Iii. php version Switch
1. Install multi-version php
sudo add-apt-repository ppa:ondrej/phpsudo apt-get updatesudo apt-get install php7.0 php5.6 php5.6-mysql php-gettext php5.6-mbstring php-xdebug libapache2-mod-php5.6 libapache2-mod-php7.0
2. php version Conversion
From php5.6 to php7.0:
Apache:
sudo a2dismod php5.6 sudo a2enmod php7.0 sudo service apache2 restart
CLI:
update-alternatives --set php /usr/bin/php7.0
From php7.0 to php5.6
Apache:
sudo a2dismod php7.0 sudo a2enmod php5.6 sudo service apache2 restart
CLI:
sudo update-alternatives --set php /usr/bin/php5.6
Reference: php version Switch
Apache + PHP + Mysql