In this lecture will install PHP, which is one of the most used server side programming languages. 1
PHP is a component of our setup that will press this code to display dynamic content. 2
Many popular CMS or Content Management Systems and frameworks such as WordPress, Magento, Joomla, 3
Drupal, or PrestaShop are written in PHP. 4
In addition to the PHP package will need php-mysql, a PHP module that allows PHP to communicate with MySQL 5
based databases. 6
So I’m installing the packages: apt update && apt install php php-mysql 7
and libapache2-mod-php 8
This is required to enable Apache to handle BPHP files. 9
Once the packages are installed, I'll restart Apache for the PHP module to get loaded. 10
systemctl restart apache2 11
You can check the version that was installed by running php-v 12
it's PHP 7.4.3 this is the built date. Let's test Apache and PHP work together 13
and are configured properly to handle dynamic content. 14
I'm creating a PHP file in the document root directory of the virtual host. 15
So in /var/www/crystalmind.academy/test.php for example. 16
And I'm adding some PHP code. 17
I'm not diving into PHP just write the code the same way I do. 18
OK, that's all. I'm saving the file and then requested with the browser. 19
So /test.php 20
And it's working; if you keep information like on this Web page, then it means that it works well. 21
But if you see the PHP code I wrote literally or if the browser tries to download the PHP file, then something 22
is not good and you have to troubleshoot and fix the problem. 23
The last required component of the lamp stack to be fully operational is the MySQL database server. We'll 24
take a short break and in the next lecture, we'll get over how to install and set up the MySQL database 25
server.