Apache configuration broken after PHP upgrade

January 27, 2014 12.9k views
Hi Everyone, I've recently update PHP version in my server, and after that my apache configuration seems to be broken, and I'm not able to fix it. If it helps, when updating, the ubuntu installer told me that the package had new configuration files that override the old ones, but told me that the default action was NOT to override them, and therefore, that's what I did. It seems now that the new version of apache is looking for that configuration files, and as I kept the old ones, it's very broke.. :S Do have any ideas of what should I do to fix it, without reinstalling the server and not loosing any virtualhost? The error I get is: apache2: Syntax error on line 211 of /etc/apache2/apache2.conf: Syntax error on line 1 of /etc/apache2/mods-enabled/fcgid.load: Cannot load /usr/lib/apache2/modules/mod_fcgid.so into server: /usr/lib/apache2/modules/mod_fcgid.so: cannot open shared object file: No such file or directory But basically, some other errors were founded until i fix them, but was not able to fix this. It has to do with PHP upgrade from 5.3 to 5.5. Thanks in advance!
5 Answers
I've recently update PHP version in my server,
How did you do that? Did you add a new repo? Apache was probably upgraded to 2.4 along with php which means that you current config file is obsolete.

I would back it up and run
sudo dpkg-reconfigure apache2
Yes, I added a new PPA repo, and updated after that. This is the package added:

https://launchpad.net/~ondrej/+archive/php5

I already tried to reconfigure the package, it does it, but when trying to restart apache, I get the same error:

* Restarting web server apache2 [fail]
* The apache2 configtest failed.
Output of config test was:
apache2: Syntax error on line 211 of /etc/apache2/apache2.conf: Syntax error on line 1 of /etc/apache2/mods-enabled/fcgid.load: Cannot load /usr/lib/apache2/modules/mod_fcgid.so into server: /usr/lib/apache2/modules/mod_fcgid.so: cannot open shared object file: No such file or directory
Action 'configtest' failed.
The Apache error log may have more information.
invoke-rc.d: initscript apache2, action "restart" failed.


So, that does not fix my problem. Any other ideas?
That repo also has updated builds of Apache. Try backing up apache's config files and re-configuring it replacing existing files with new ones

Complete remove apache2 and install it again and then libapache2-mod-php5. This worked for me. :)

Hello dear Ocean travelers!

I quote pmartelleti: "If it helps, when updating, the ubuntu installer told me that the package had new configuration files that override the old ones, but told me that the default action was NOT to override them"

Do you know if selecting override would have changed the configurations that much?
I am wondering how to get past this problem in the future!

Thanks a lot!
Have a wonderful day!
Cheers,
Lionel

Have another answer? Share your knowledge.