18 Day 18: Configure LAMP server

I’ve performed below every steps still showing error, can you please rectify it. need help

Install httpd, PHP, and dependencies on all App Hosts

Install Apache and PHP

  • sudo yum install -y httpd php php-mysqlnd

Start and enable httpd

  • sudo systemctl start httpd
  • sudo systemctl enable httpd

Configure Apache to serve on port 5000

  • sudo sed -i ‘s/^Listen 80/Listen 5000/’ /etc/httpd/conf/httpd.conf

Install and configure MariaDB on DB Server

  • sudo yum install -y mariadb-server
  • sudo systemctl start mariadb
  • sudo systemctl enable mariadb

Create the Database and User on the DB Server:

  • sudo mysql -u root
  • CREATE DATABASE kodekloud_db5;
  • CREATE USER ‘kodekloud_gem’@‘%’ IDENTIFIED BY ‘TmPcZjtRQx’;
  • GRANT ALL PRIVILEGES ON kodekloud_db5.* TO ‘kodekloud_gem’@‘%’;
  • FLUSH PRIVILEGES;
  • EXIT;

Configure WordPress on App Hosts

sudo cp wp-config-sample.php wp-config.php

  • Edit wp-config.php to match DB

  • define(‘DB_NAME’, ‘kodekloud_db5’);

  • define(‘DB_USER’, ‘kodekloud_gem’);

  • define(‘DB_PASSWORD’, ‘TmPcZjtRQx’);

  • define(‘DB_HOST’, ‘<DB_SERVER_IP>’);

Set correct permissions:

  • sudo chown -R apache:apache /var/www/html
  • sudo chmod -R 755 /var/www/html

Showing this error
Error establishing a database connection

Hi @tariqueali1731

Did you execute these steps on the appropriate Servers?
A screenshot would have helped.

Can you please share the link to the lab?

Hi @Santosh_KodeKloud
Thank you for your kind response.
it worked now, finally done.