How Do You Install Zabbix Server on RHEL 7.x Running in AWS?

Problem scenario
You have a RedHat Linux server with only 1 vCPU and 1 GB of RAM.  You want to install Zabbix Server to monitor other servers.  How do you deploy Zabbix server to an AWS instance of RHEL?

Solution
1. Install the LAMP stack components by running this command:
sudo yum -y install php httpd mariadb-server

2.  Install essential Zabbix components with these four commands:
sudo rpm –import http://repo.zabbix.com/RPM-GPG-KEY-ZABBIX

sudo rpm -Uv 

Why Does PHP Return “Resource Id #2” Or “Resource Id #3”?

Problem scenario
In a LAPP stack deployment, a PHP variable is displaying a value “Resource id #2” or “Resource id #3.”  You are expecting a different value.  The PHP variable having the problem is the result of a SQL command ran against a PostgreSQL database.  What should you do?

Solution
Assuming that $var1 is displaying the undesirable “Resource id #2” or “Resource id #3”,

How Do You Run a SQL Query to Identify the Primary Key of a Table in a PostgreSQL Database?

Problem scenario
You are using PostgreSQL and currently administering a database you inherited from a different company.  You want to determine the primary key of a given table.  How do you identify the primary key of a table?

Solution
Modify the query below so you replace “contint” with the name of the table you are interested in.  The result of this SQL query will be the primary key of that table.

How Do You Create a Primary Key in a PostgreSQL Table That Already Exists?

Problem scenario
You have a table that you would like to have a primary key.  You would like to add a new column to be the primary key.  How do you do this?

Solution
Here is a SQL command that is an illustration.  Assuming the table’s name is “contint” and the new column you want to add is “continual_col” with a value type of integer,

How Do You Solve This SQL Problem When You Receive the Message “ERROR: Syntax Error at or Near”?

Problem scenario
You are trying to update a SQL table with a SQL statement (using the “UPDATE” keyword).  You keep getting “ERROR:  syntax error at or near” with a reference of the value you are trying to give to a cell in a row in a SQL table.  You verified you have no extra commas, apostrophes, or semicolons in your SQL UPDATE statement.  You verified that the columns exist in the table and are spelled correctly in your UPDATE statement.

How Do You View Failed User Login Attempts to a PostgreSQL Instance?

Problem scenario
You are running a LAPP application on Ubuntu Linux with PostgreSQL.  A user has complained that she cannot log into your Postgres database via a LAPP application.  You are not sure if the attempts are even registering of if the user is entering an incorrect username.  How do you look at a log to see a history of unsuccessful attempts at logging into the Postgresql database?

Solution
Examine this file: /var/log/postgresql/postgresql-x.y-main.log

(Substitute x.y with the major and minor versions of PostgreSQL you are running e.g.,

How Do You Create an Option to Logout for a PHP Web Page to Destroy the Session?

Problem scenario
You have a LAMP (or LAPP) web page application.  The PHP code uses the session() functionality.  Once a user logs in successfully, he/she can browse to successive web pages.  You want to at least allow the user the opportunity to destroy the session (and terminate the authentication session).  How do you do this?

Solution
#1  Modify the .php file that you want to have the logout feature. 

How Do You Change the Password of the PostgreSQL Instance Account Named “Postgres”?

Problem scenario
You want to change the password at the SQL level — not with the OS — of the user named Postgres in your PostgreSQL install.  How do you change this password?

Solution
1.  Enter the SQL database to run a DDL command.
2.  Run this command to change the user named “postgres” to the password “abcd1234” with no quotes:

ALTER USER “postgres” WITH PASSWORD ‘abcd1234’;

How Do You Configure the LAPP Stack to Authenticate and Allow Subsequent Pages Navigable Based on the Original Authentication?

Problem scenario
You are deploying a LAPP (Linux, Apache, PostgreSQL, and PHP) stack. You want the authentication to be done via a Postgres database behind-the-scenes.  You can control the credentials from the back end this way.  You want the user to be able to click around in the application once logged in.  You want only one challenge for user login credentials.  

How do you create a PHP login page (i.e.,

How Do You Troubleshoot a 500 URL Return Code with a PHP Web Page That Is Using pg_connect?

Problem scenario
You have an Apache web server with PHP code.  You are trying to integrate web pages with Postgresql.  When browsing to a web page (.php), you are getting a 500 URL return code.  Your PHP web page file is using the reserved command “pg_connect.”  How do you overcome this 500 URL return code error and have the web page work?

Solution
Possible solution #1:  Reboot the web server.