How Do You Get a PHP Script to Invoke a Bash Command?

Problem scenario
You are trying to get a PHP file to invoke a bash script. When you run it from the command line with “php foobar.php” you just see the content of the PHP file. What do you do to get PHP to invoke a bash script?

Solution
Make sure you have the correct header and closing symbols. Here is the content of foobar.php:

<?php
exec(‘bash /var/www/html/testScript.sh’);  » Read more..

What Are Some Tips on a Bash Programmer Becoming a PHP Programmer?

Problem scenario
You are a Bash programmer, but you want to learn how to code in PHP.  How do you learn to develop PHP scripts when you have a Linux bash background?

Solution
If you are new to PHP programming and familiar with Bash programming, remember these tips:

1.  Variable assignments involve the variable with the syntax of a cash sign “$” before the variable name. 

 » Read more..

How Do You Troubleshoot the PHP Syntax Error “unexpected end of file in …”?

Problem scenario
You receive this message “PHP Parse error:  syntax error, unexpected end of file in /path/to/file.php on line x.”  How do you solve this?

Solution
Verify you have a closing brace for every open brace.  You may want to go to this site to help you find an unmatched brace.

 » Read more..

How Do You Troubleshoot PHP Not Displaying the Output of a Bash Command?

Problem scenario
You have a PHP program that works from the back-end (from a command terminal executing like php foobar.php). When you view the program in a web browser, it is not running the Bash commands properly. What should you do?

Solution
The root cause is probably the user execution context and a variety of permissions or configuration settings on the Linux system.

 » Read more..

How Do You Write a PHP Web Page That Asks for a SQL Table Name Then Returns the Contents after the User Clicks a Button?

Problem scenario
You want users to be able to enter a table name and then see the content of the table.  How do you create a webpage with a text field and a submit button that will display the content of the table if it exists?

Solution
Overview
This assumes you have the LAPP stack set up on a single server.  To set up the LAPP stack on Ubuntu,

 » Read more..

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. 

 » Read more..

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 bundle of software that (includes an OS and) can create a complete and functional product when properly configured.  We will define these acronymous words below. 

 » Read more..

How Do You Get an Apache Web Server to Publish a Specific .PHP File on a CentOS/RHEL/Fedora Server?

Problem scenario
You are using a RedHat derivative distribution of Linux.  You want to install Apache Web Server on it so it can publish PHP content.  How do you install and configure the necessary dependencies to do this?

Solution
1.  Install Apache web server:  sudo yum -y install httpd

2.  Install PHP:  sudo yum -y install php

3.  Examine the httpd.conf file. 

 » Read more..

How Do You Use PHP Variables in HTML?

Problem scenario
You have a .php file with PHP and HTML code.  You want an HTML text field to be display a pre-populated text value by default.  The user can then modify this value from the web UI (i.e., front-end).  You want this text value to be based on a PHP variable (calculated in earlier in the code).  How do you get your HTML code to display the value of a PHP variable?

 » Read more..

How Do You Deploy a LAMP Stack Application Powered by Kubernetes?

Problem scenario
You want to deploy your own LAMP stack with the power of Kubernetes.  You do not want to rely on official Docker Hub images for the underlying Docker containers.  How do you do this?

Solution
1.  Deploy Kubernetes to AWS.  If you need help to deploy Kubernetes to AWS, see this link.  If you need assistance installing kubectl on any type of Linux (CentOS/RHEL/Fedora,

 » Read more..