Apache HTTP Server and PHP are widely used technologies for hosting dynamic websites and web applications. Installing Apache with PHP through source compilation provides greater control over versions, modules, performance optimization, and custom configurations compared to package-based installations. This method is commonly used in environments where administrators require specific features or compatibility settings that are not available in default repository packages.
Prerequisites
Before starting the Apache and PHP source installation, ensure the following requirements are met:
A Linux server with root or sudo access
Basic knowledge of Linux command-line operations
Development tools and compilers installed (gcc, make, perl, etc.)
Required dependencies and libraries installed
Stable internet connection to download source packages
Available ports (typically 80 and 443) for Apache
Sufficient disk space and system resources
IMPLEMENTATION
How to install/compile Apache with PHP via source installation?
If you like to install PHP with Apache via source installation, kindly follow the steps below.
This PHP installation is compiles with major modules like GD, MCrypt, xml,etc
7.make (if u do it again install do a “make clean”)
8.make test
9.make install
10.If file /usr/local/apache/modules/libphp5.so does not exist or is an older version, type this (change this to libphp4.so for PHP 4):
   cp -p .libs/libphp5.so /usr/local/apache/modules
11.In httpd.conf
# Use for PHP 5.x:
#Add at the end of the file
#LoadModule php5_module       modules/libphp5.so
AddHandler php5-script phpÂ
AddType application/x-httpd-php-source phps
# Add index.php to your DirectoryIndex line:
DirectoryIndex index.html index.php
AddType text/html      php
12.cd /usr/local/apache2/htdocs
13.vim index.php
——————–
——————–
14./usr/local/apache2/bin/apachectl restart
15.lynx www.hemanth.com
16.You should see the phpinfo page
Conclusion
Compiling Apache and PHP from source allows administrators to build a highly customized web server environment tailored to specific application requirements. Although the process requires more effort than package-based installations, it provides flexibility, better control over enabled modules, and the ability to use custom software versions. Proper planning, dependency management, and regular updates are important to maintain server stability and security after installation.