How Do You Return Basic Messages from a SQL Query to a PHP Web Page When Using LAPP?

Problem scenario
You have deployed the LAPP stack. You want a basic and meaningful message to be presented to a user of the web application after a SQL command has been run.  Currently a user can click on buttons to run SQL commands behind the scenes.  Messages that are returned to the user may be meaningless like “Resource id #4” or “Resource id #5.”  You want to augment the functionality so at least a rudimentary message (with some meaning) is returned to the user. 

How Do You Deploy LAMP with Ubuntu Linux?

Problem scenario
You want to deploy the LAMP stack on a Debian/Ubuntu distribution of Linux. You want to install and the four core technologies that compose the LAMP stack (Linux, Apache web server, MariaDB/MySQL, and PHP).   How do you do this?

Solution #1 (with MySQL)
To install the OS, Ubuntu Linux, see this link. To install MySQL run these commands:

sudo apt-get -y update
sudo apt-get -y install php apache2 mysql-server

# Provide a password for the mysql root user when prompted. …

How Do You Connect to an Amazon RDS Instance?

Problem scenario
You created an Amazon RDS instance that uses PostgreSQL.  How do you connect to it without using the AWS CLI or AWS API from a Windows workstation?

Solution

Prerequisites

  • Install HeidiSQL on your Windows machine.  (Toad or other SQL front-end applications can work too.)
  • You need a username and password for the PostgreSQL instance. 

How Do You Create an Amazon RDS Database Instance?

Problem scenario
You want to test out an Amazon RDS database instance.  (You want to use a database PaaS offering and VPC as opposed to EC-2.)  What do you do?

Solution
1.  Log into the AWS console.  
2.  Click “Launch a DB instance”
3.  Choose the database engine you want (e.g., PostgreSQL). Click “Next”.
4.  Click the option for “Dev/Test” and click “Next”.

What Are the Different Acronym Stacks in I.T.?

Question
What are the different acronym stacks in I.T.?

Answer
There are many open source combinations of technologies that are in wide use.  These acronyms referred to as “full stacks” or “stacks” appear in articles and job descriptions.  A full stack is a bundle of software that (includes an OS and) can create a complete and functional product when properly configured. 

How Do You Troubleshoot the Error “ERROR 2002 (HY000): Can’t connect to local MySQL server through socket ‘/var/lib/mysql/mysql.sock’ (2)”?

Problem scenario
You install mysql on a RedHat (RHEL) Linux server in AWS.  You run this command: mysql -u root -p

But you get this message:
ERROR 2002 (HY000): Can’t connect to local MySQL server through socket ‘/var/lib/mysql/mysql.sock’ (2)

How can you get around this problem and get to a SQL interface?

Solution
sudo systemctl start mariadb.service

How Do You Prepopulate Text Fields in a Web Page with Values from a SQL Database?

Problem scenario
You have a web page from an .php file that includes HTML code.  There are fields visible in the web page to the user.  These fields accept text. You want the fields to not be blank; you want the fields to have suggested values of text in them. You want the data in the fields to be taken from the result of a SQL statement.  How do you prepopulate text fields in a LAPP web page with values from SQL statements?

How Do You Optimize SQL to Get Away from Disk Contention, to Reduce the I/O Activity?

Problem scenario
Let’s say you want to rearrange the columns a of SQL table because a special order would make subsequent SQL commands easier.  Or you just want to avoid disk contention on the underlying storage device.  How do you optimize SQL to do less input/output activity on the disk while being able to rearrange the order of columns?

Solution
There are other ways such as avoiding “select *”,