I have installed Apache2 and it was working fine. I had also installed PHP 7.1 and everything was working fine, until I installed phpMyAdmin. Yes, all of a sudden Apache failed with an error message “Apache2 configtest failed”.
Below is the apache2 failed error:
root@osticket-server:~# /etc/init.d/apache2 restart * Restarting web server apache2 [fail] * The apache2 configtest failed. Output of config test was: Segmentation fault (core dumped) Action 'configtest' failed. The Apache error log may have more information.
Couldn’t find any error message in Apache error log other than the above on the command line:
How to fix Apache2 configtest failed error?
Solution: If configtest fails, there is nothing to PANIC. In most cases, the issue might be due to the conflict between the modules. Yes, there could be conflict between the modules installed in the past with the one installed now.
In my case, it is because of the conflict between PHP5 & PHP7.1 modules.
Look for the modules:
cd /etc/apache2/mods-enabled ls -lrt lrwxrwxrwx 1 root root 29 Oct 16 04:55 php7.1.load -> ../mods-available/php7.1.load lrwxrwxrwx 1 root root 29 Oct 16 04:55 php7.1.conf -> ../mods-available/php7.1.conf lrwxrwxrwx 1 root root 27 Oct 16 05:24 php5.load -> ../mods-available/php5.load lrwxrwxrwx 1 root root 27 Oct 16 05:24 php5.conf -> ../mods-available/php5.conf
From the above list, you can find both the modules being enabled. Disabling either of the module will solve the problem.
How to disable the Apache2 module
You can use a2dismod command for disabling:
Restart Apache2 service
service apache2 restart