The steps:
1.Check Linux version
#uname -a
2. Kali 2017 has php7.0 by default. We need php5 for Dvwa.
#php7.0 -v
3. Add debian repo
#apt-get update
4. install php5
#apt-get install php5libapache2-mod-php5
5. if 4) is not working, add the old repository to your source list.
#echo 'deb http://old.kali.org/kali sana main non-freecontrib' >> /etc/apt/sources.list && apt-get update
6. run 4) again
7. #apt-get install php5
8. Verify php5 version
#php5 -v
9. get DVWA from github
https://github.com/ethicalhack3r/DVWA
10. clone DVWA on Desktopfolder
#cd Desktop
#git clone https://github.com/ethicalhack3r/DVWA
11. move DVWA folder to dvwafolder
#mv DVWA/ dvwa
12. move dvwa folder to/var/www/html/
#mv dvwa /var/www/html/
13. turn on php5 allow urlsetting
#leafpad/etc/php5/apache2/php.ini
in php.ini, Find"allow_url", change allow_url_include = on
save the file
14. Change config.inc.php.dist to config.inc.php
#cd /var/www/html/dvwa
#cd config/
#mv config.inc.php.distconfig.inc.php
15. Edit config.inc.php
#gedit config.inc.php
in the file: check ReCAPTCHAsetting
goto the google url states inthe file in firefox: https://www.google.com/recaptcha/admin/create
your recaptcha site: dvwa
use site key asrecaptcha_public_key
use secret key asrecaptcha_private_key
change 'db_password' = 'toor'
save the file
16. start services
#cd ~
#cd Desktop
#service apache2 start &&service mysql start
#service apache2 status
#service mysql status