By following this you will be able to install apache2.4 server on either windows10 or ubuntu 20.04 machines and configure it to work with PHP.
Install apache2.4 server on Windows systems
Step-1 Download Apache2.4Download the required version of Apache from here. Here we consider of installing Apache 2.4.43 x64 with OpenSSL support. This link will download a ".zip" file. Before installing this package make sure you have installed the Visual C++ 2015 redistributable from here
Step-2 Install Apache2.4Installation here means just extract the downloaded "zip" file to C:\Apache24 folder. Now we have to register the apache2 to windows services to start automatically when windows starts.
For this open the "Command Prompt" as Administartor and run the following Commands.
C:\Windows\System32>cd C:\Apache24\bin
C:\Apache24\bin>httpd.exe -k install
You will get 'The "Apache2.4" service is successfully installed' message means you have configured Apache2.4 service correctly on your windows machine.
Now open your browser and enter url as http://localhost, you will see a message "It Works!" means your Apache2.4 server is configured correctly and accepting requests also.

From now onwards Apache2.4 service will start automatically with windows. You can manage this service by going to "services.msc" via "Run"
(press " + R" to access Run)Step-3 Configure Apache2.4 to work with PHP
To continue this step, you should have installed PHP on your system. If not done yet do it by following the below link.
Read Also: Install PHP on Windows, Ubuntu Machines
Now open the httpd.conf file from C:\Apache24\conf add the following lines at the end of file.
LoadModule php7_module "C:/php7.3/php7apache2_4.dll" AddHandler application/x-httpd-php .php PHPIniDir C:/php7.3
Please observe C:\php7.3 is the path where PHP is already installed, change this location as per your PHP installed location. Now save this file and restart the "Apache2.4" service by accessing from "services.msc".
Step-4 Test PHP working with Apache2.4From now onwards Apache2.4 server can parse ".php" files. To test its working let's create a test file info.php and save at the server document root path C:\Apache24\htdocs. Add the following line to this file and save it.
<?php phpinfo(); ?>
Now open your browser and enter the url "http://localhost/info.php". You should be able to see the following page showing the PHP configuration installed on your system.

If you could able to get it, congratulations! you have successfully installed and configured PHP and Apache2.4.
Read Also: Install Composer on Windows, Ubuntu Machines
Install apache2.4 server on Ubuntu
Step-1 Install Apache2.4To install Apache2.4 run the follwoing commands on terminal.
$ sudo apt update
$ sudo apt install apache2
First line will update the repositeries and second line will install "Apache2.X" latest stable version available. After installation is finished a success meassage will be displayed.
Now verfiy its installation by opening a browser and enter url "http://localhost". If installation is successful the following like page appears on your browser.

Default location of hosted website is /var/www/html. To make your website running place your files here. This location can be edited by editing its virtual host file present at /etc/apache2/sites-enabled/000-default.conf
Read Also: Install PHP on Windows, Ubuntu Machines
Step-2 Configure Apache2.4 to work with PHPTo make your installed "Apache2.4" server parse .php files you have to install libapache2-mod-php PHP module using the following command.
$ sudo apt-get install libapache2-mod-php
After successful installation restart Apache2 service using following command.
$ sudo service apache2 restartStep-3 Test PHP working with Apache2.4
To test its working let's create a test file info.php and save at the server document root path /var/www/html/. Add the following line to this file and save it.
<?php phpinfo(); ?>
Now open your browser and enter the url "http://localhost/info.php". You should be able to see the PHP configuration installed on your system.
If you could able to get it, congratulations! you have successfully installed and configured PHP and Apache2.4.