Apache config error Invalid command ‘php_flag’ Ubuntu 16.04

I have just started to upgrade some servers to Ubuntu 16.04.  It looked good until I rebooted to the server and the Apache2 service didn’t start up properly.  I view the logs in systemd.  Using the command: systemctl status apache2.service ● apache2.service – LSB: Apache2 web server Loaded: loaded (/etc/init.d/apache2; bad; vendor preset: enabled) Drop-In: … Read more

a2ensite ERROR: Site www.example.com does not exist! Ubuntu 13.10

On our Ubuntu 13.10 server, I had created an apache configuration file for a virtual host however, I could not enable it using a2ensite. The file was here: I tried to enable it: However, the command complained that ERROR: Site www.example.com does not exist! The files clearly exists. It turns out the this command only … Read more

How to pipe Apache logs to a python script

I wanted to pipe the output of my Apache’s error logs to a Python script. To do this you need to set the a CustomLog directive in your Apache Config. Edit /etc/apache2/sites-available/default and add the following line: To read the input into Python you need to setup a non-blocking read from stdin. Obviously, this script … Read more

How completely reconfigure apache2 configuration files

I tried upgrading one of our servers from Apache 2.2 -> Apache 2.4. It didn’t work so I purged the PPA but the configurations needed rolling back too (which ppa-purge command didn’t do). So, to completely remove Apache2 configuration files and reinstall them use the following command: and then had to also reinstall php5: Hope … Read more