The installation of Apache on Linux distributions is straightforward. This article specifically utilizes CentOS 6.9.
Note: An active internet connection is required on the Linux machine for installation.
1 – Installation of the httpd package
Execute the following commands to install Apache:
yum -y install httpd
2 – Installation of the PHP module
yum -y install php
3 – Enabling Apache on system boot
chkconfig httpd on
4 – Starting the httpd service
service httpd start
To verify Apache’s functionality, open a browser and enter the Linux machine’s IP address or hostname. The default Apache page should appear.

For PHP testing:
1. In the /var/www/html directory, create a PHP test file:
cd /var/www/html/ vi teste.php
2. In the vi editor, press “i” to enter insert mode and input the following PHP script:
<?php
phinfo();
?>
3. Press :x to save and exit the editor.
By navigating to http://<linux_machine_ip>/teste.php, a page displaying PHP version and details should be displayed.

Note: The vi editor was utilized here. If it’s not installed, it can be installed using:
yum -y install vim




Leave a Reply