Web application is not able to connect to the Database

Task 35 of the AWS Cloud, Web application is not able to connect to the Database after several trials still not getting a successful connection but only the Apache…

Pls help with a step-by-step troubleshooting…

Thanks.

Hello,i’ve got same issue and i figured it out.
My case was i’ve got telnet from the web to the DB with port 3306,and when i open the web app,my output was last 4 lines of the script,which still tells i’ve got successful connection.
My “mistake” if i can say it was: I renamed index.php to index.html which i think was right,but somehow it’s not.Also have to give ownership to the www-data user.Here are the commands:

  1. Give permission to index.php for apache
    sudo chown www-data:www-data /var/www/html/index.php sudo chmod 644 /var/www/html/index.php
  2. Remove default apache welcome page.
    sudo rm /var/www/html/index.html
  3. Restart apache
    sudo systemctl restart apache2

When you open the web adress,what output you got ?