When it comes to websites and web applications, many people use the term stack to describe the environment
where these sites and apps are developed and served from.
The typical web server stack consists of four parts and operating system, a web server, a database,
and a scripting language.
For many years, the primary web stack has been the lamp stack.
In this case, Linux is the operating system.
The Web server is Apache.
The database component is my SQL or Maria DB, and the scripting language is either PHP, python or
Perl, with PHP being the one most commonly referred to because the components of the web stack can
be swapped out using jinks for the web server leads to the lunch stack.
The other components remain the same.
In this case, Jenks is represented by the letter E for the Sound of the Jinx name rather than its spelling.
Now let's take a look at getting configured to run dynamic applications with Jinx, Maria, DB and PHP.
To get started with our lymph stack.
I'm already connected to our development team with Jinx installed.
Now let's install PHP, also known as the hypertext preprocessor.
PHP is a general purpose scripting language especially suited to web development.
You can learn more about PHP at PHP dot net.
We'll be working as the route user, so we need to elevate our session with pseudo su dash.
Now we can run apt update to make sure the package repositories are up to date.
And now we can install the PHP packages.
We'll do this with APT, install php, FPM and php mysql.
This will install the PHP fast process manager and any other packages we need for a PHP.
The fast CGI process manager is a service that will process any PHP files received by the web server.
And a PHP.
MySQL package is a package that allows PHP to connect to a MySQL database.
Once the installation is complete, we can check the version of PHP that got installed by running PHP
version.
In this case we'll be using PHP 7.2.5.
Now let's check the PHP fast CGI Process manager.
This gets installed as a service and we can make sure it's up and running with system CTL.
Four php fast cgi.
The name of the service is PHP 7.2 fpm.
Great.
This output tells us that PHP FPM is up and running.
At this point we're ready to configure Jinx so that it can communicate with the PHP service.
So let's edit our conf file for our site.
In the conf file we need to add a location with a case sensitive regular expression that matches URI
ending in PHP.
Next, we'll use the include directive to bring in some code that's stored outside of our config file.
The fast php conf file contains helpful directives that improve the security and efficiency of the site.
Now let's add a fast CGI underscore pass directive.
This directive tells Jinks to use a unique socket to communicate with php fpm.
Communicating through a socket keeps the transfers between jinks and PHP on the local system much faster
than communicating via a TCP port.
We can also add one more directive.
Fast.
CGI underscore, intercept, underscore errors and then add the keyword on.
This tells Jinks that if any errors are returned by the fast CGI server in this case FPM, that jinks
should try to process that error with an error page directive.
If possible, Jinks will consider errors from the fast CGI process as 500 errors, so these will be
handled by our custom 50 x HTML page.
Now let's save the file and test our configuration.
Everything looks good there.
So let's go ahead and reload the configuration.
Now, the only thing we need is some PHP content.
Let's create a PHP info page in the root directory of the demo site.
In this file we'll put some PHP code that will return details about our PHP installation.
These commands will provide details on our PHP installation served as a dynamically generated web page.
I should add that making the PHP info function output available on a web page should only be used for
development and never in production.
The details on the page might give a hacker or otherwise nosy visitor to our site more information about
our site than they need, making it a target for attack.
Now we can go to the browser and test the info page on our demo site.
Now enter 192.168.0.3, which is the IP address for our site.
And then info dot php.
Nice.
Seeing our info page confirms that we have php FPM installed and jinks configured to use it for processing
web pages with PHP.
Let's wrap up the session here and move on to installing the database server for our limp stack.
Maria db.