fastest way to update /etc/apache2/sites-enabled/(virtual server).conf for all websites when changing to mpm-event

hi guys,
i have just completed the change from mpm-prefork to mpm-event in debian.

After making the changes and enabling mpm-event, of course apache would not restart, due to the sites-enabled conf file for each virtual server containing the following entry… “php_admin_value engine off”

say for example the following sites existed

  • /etc/apache2/sites-enabled/site1.conf
  • /etc/apache2/sites-enabled/site2.conf
  • /etc/apache2/sites-enabled/site3.conf

I went in and manually edited each file, however, what is a faster way?

What if one had hundreds of websites on a server?

Does this happen because i disabled rather than removed/uninstalled the old configuration used by the default apache installation?


You can mass change config files using tools like Perl or sed.

One example of how to do that would be a command like this:

perl -pi -e 's/php_admin_value/#php_admin_value/g' /path/to/files/*.conf

That will look for all instances of “php_admin_value” in those .conf files, and place a “#” mark in front of them.

Of course, before making any changes like that, be sure to back up all those config files!


Awesome, thanks Eric.