Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is the difference between PHP and libapache2_mod_php

I’m new to system administration and while launching oho files with Apache 2 server I had to install php on my Ubuntu 16.04.

I tried the basic sudo apt-get install php, which only loaded a blank page (php file).

But installing libapache2_mod_php solved my problem.

I want to understand the differences .

like image 725
Deeraj Theepshi Avatar asked Dec 07 '22 14:12

Deeraj Theepshi


1 Answers

It's pretty simple: Apache is WWW Server, PHP - a interpretter. By libapache2_mod_php library, the Apache can send request to the PHP, which builts website, sends rendered HTML (or whatever else) to the Apache, and it is later responsed to the user.

The flow is something like that: enter image description here

without that library, the Apache don't know what is .php file, and recognizes it like raw file which can be downloaded, without being interpreted by PHP (sometimes it's very dangerous, for example when you are storing passwords in PHP file).

like image 140
Siper Avatar answered Dec 10 '22 03:12

Siper