Pages

Tuesday, September 3, 2013

No apache MPM package installed - debian/ubuntu

Guide to Reinstalling Apache2 with PHP5 Support

If you're working on a legacy server or application that requires Apache2 with the mpm-prefork module and PHP5, the following sequence of commands and their purposes can help you manage the installation and configuration process. This workflow is common when troubleshooting or restoring old PHP5-based web applications.

1. Purge and Reinstall Apache2 MPM Prefork

bash
apt-get purge apache2-mpm-prefork apt-get install apache2-mpm-prefork
  • Purpose: Removes the current installation of the apache2-mpm-prefork module and reinstalls it. This is sometimes necessary if the module is corrupted or if you need to reset its configuration. On Debian-based systems, only one MPM (Multi-Processing Module) can be active at a time.

2. Stop Nginx and Start Apache2

bash
/etc/init.d/nginx stop service apache2 start
  • Purpose: Stops the Nginx service to avoid port conflicts (usually on port 80), then starts the Apache2 service. This is essential if both web servers are installed on the same machine, as they cannot both bind to the same port simultaneously.

3. Restore PHP5 Module Configurations

bash
cp -arp /root/apache2/mods-available/php5* /etc/apache2/mods-available/ cp -arp /root/apache2/mods-enabled/php5* /etc/apache2/mods-enabled/
  • Purpose: Copies backup PHP5 module configuration files back to their respective directories. This is often required if these files were lost or overwritten during package changes or upgrades. The mods-available directory contains all available modules, while mods-enabled contains symlinks to the modules currently enabled for Apache.

4. Restart Apache2

bash
service apache2 start
  • Purpose: Ensures Apache2 is running with the new or restored module configurations. Use this after restoring module files to apply changes.

5. Install PHP5 Apache Module

bash
apt-get install libapache2-mod-php5
  • Purpose: Installs the PHP5 module for Apache2, allowing Apache to interpret PHP scripts. Note that on modern systems, this package is obsolete and may not be available in default repositories. For Ubuntu 16.04 and later, PHP7 is the default, and you may need to use a third-party PPA to install PHP5.

No comments:

Post a Comment