The following is done on an Ubuntu machine but hoping it should cover other Debian instances.
I accidentally deleted php7.0.conf and php7.0.load from the mods-available folder. These files come with libapache2-mod-php. I uninstalled the module and installed it again – but the files didn’t appear. A lot of blogs suggested to remove Apache, PHP and libapache2-mod-php altogether and installing it again and it didn’t work. I used remove, purge and everything suggested but didn’t help. Eventually, I had to search for the installed module by:
dpkg --get-selections | grep libapache2-mod-php
I installed the module above as is but the result showed me libapache2-mod-php7.0. So I went ahead and removed and purged the module listed after which I installed the module again (without the 7.0 suffix) and I was able to recover the files again.
apt-get remove --purge libapache2-mod-php7.0 apt-get install libapache2-mod-php
Since I am covering this topic, let’s talk about installing Apache on Debian and the supported PHP packages along with SSL support.
apt-get install apache2 apt-get install php apt-get install php-curl apt-get install libapache2-mod-php
Enable SSL on the site:
cd /etc/apache2/sites-enabled ln -fs ../sites-available/default-ssl.conf
Finally, add the necessary modules to support PHP/SSL on Apache
cd /etc/apache2/mods-enabled ln -fs ../mods-available/ssl.conf ln -fs ../mods-available/ssl.load ln -fs ../mods-available/socache_shmcb.load ln -fs ../mods-available/php7.0.conf ln -fs ../mods-available/php7.0.load
Do not forget to restart apache with
service apache2 restart