How to prevent PHP update from creating generic config file and changing permissions

Michelle asked:

We use suPHP and whenever our php packages are updated, a new php.conf file is dropped into the apache config folder (/etc/httpd/conf.d) and this causes 500 error’s as it configures the handler for php scripts to be the standard php interpreter (AddHandler php5-script .php) instead of suphp. When this happens we have to manually delete php.conf and restart Apache.

In addition the PHP package also changes the ownership of /var/lib/php/sessions to root:apache and we need it to be root:suphpgroup.

Any ideas on how we can avoid these two issues caused by every PHP update?

My answer:

Create a blank /etc/httpd/conf.d/php.conf and leave it there. The RPM packages will not overwrite it, since it’s changed from the original distributed file; instead they’ll create it as php.conf.rpmnew which Apache will ignore, and you can go clean up later at your leisure.

View the full question and any other answers on Server Fault.

Creative Commons License
This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License.