How Do You Solve the Apache Web Server Problem That Says “AH00558: apache2: Could not reliably determine the server’s fully qualified domain name”?

Problem scenario
Your website is not working.  When you browse to the login page, the browser loads forever.  There seems to be a problem with the web server itself.

On the back end, you run this command from the operating system’s command line:
netstat -anlp | apache2

You see this as the result of this command:
“AH00558: apache2: Could not reliably determine the server’s fully qualified domain name,

How Do You Avoid Using the Root User When Doing Linux Administration?

Problem scenario
You’ve been given root credentials.  How do you create a new user and make it a sudoer so you can install and remove OS packages?

You know that it is best to use a non-root user for Linux administration. You have been given a root user.  How do you create a non-root user with full sudoer privileges?

Solution
This example assumes that the username is “mike.” 

How Do You Troubleshoot the Error “Errors were encountered while processing: docker.io E: Sub-process /usr/bin/dpkg returned an error code (1)”?

Problem scenario
You want to remove Docker from your Ubuntu server.  You tried this command:

sudo apt-get remove docker

But you see this:



 Active: failed (Result: exit-code) since Sun 2017-08-06 21:59:11 EDT; 11ms ago
     Docs: https://docs.docker.com
  Process: 21981 ExecStart=/usr/bin/dockerd -H fd:// $DOCKER_OPTS (code=exited, status=1/FAILURE)
 Main PID: 21981 (code=exited, status=1/FAILURE)
   Memory: 14.0M
  

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.

How Do You Read in Keyboard Input from a User and Invoke a Unix Shell Command with a C++ Program?

Problem scenario
You want to see how C++ works.  You want to read in user input from the keyboard and have the C++ program run a bash command.  How do you do this?

Solution
Compile this code (e.g., as a file named “test.cpp” with “g++ test.cpp”) and run it (e.g., ./a.out):

#include <iostream>
#include <stdio.h>
#include <stdlib.h>
using namespace std;

Where Are the apt-get Repo Configuration Files for a Debian/Ubuntu Linux Server?

Problem scenario
You run an apt-get command, and you get an error about a .deb file’s source not being found.  For example you try to run an apt-get command to install a package, but you are blocked by this error:
“E: Failed to fetch http://archive.ubuntu.com/ubuntu/pool/main/p/postgresql-9.5/libpq-dev_9.5.6-0ubuntu0.16.04_amd64.deb  404  Not Found [IP:…”

An updated version for the deb file may have superseded the older version.  Or the repository server’s hostname may have changed or its IP address has changed. 

How Do You Fix the Problem “Unable to locate package php-pgsql”?

Problem scenario
You are trying to integrate PHP and Postgresql on you Ubuntu/Debian Linux OS.  You run this command:  sudo apt-get -y install ​php-pgsql

You receive this error:

Reading package lists… Done
Building dependency tree
Reading state information… Done
E: Unable to locate package ​php-pgsql

What should you do?

Solution
#1  Find out what version of php you have. 

How Do You Troubleshoot This Error “…docker.sock: read:: connection reset by peer”?

Problem scenario
You have Docker installed.  When running “docker ps” you get this error:  “An error occurred trying to connect: Get http://%2Fvar%2Frun%2Fdocker.sock/v1.24/containers/json: read unix @->/var/run/docker.sock: read: connection reset by peer”

How do you fix this error so you can use Docker?

Solution
Just because Docker was installed does not mean that the kernel of your OS is supported.  Docker may not work despite being installed. 

How Do You Troubleshoot a PHP Page Showing the Raw Code in a Web Browser?

Problem scenario
You created a PHP web page, but it is not rendering correctly in a web browser.  You see the raw PHP code or text.  What do you do to get the PHP to display correctly as a web UI (and not raw code and uninterpreted text)?

Solution
Possible solution #1
Install PHP.  For assistance with installing it on a Debian/Ubuntu server,