0

I am trying to restart Apache2, but whenever I run the command, this happens:

Job for apache2.service failed because the control process exited with error code. See "systemctl status apache2.service" and "journalctl -xe" for details.

Now, when I type "systemctl status apache2.service", it prints out this:

● apache2.service - LSB: Apache2 web server
   Loaded: loaded (/etc/init.d/apache2; bad; vendor preset: enabled)
  Drop-In: /lib/systemd/system/apache2.service.d
           └─apache2-systemd.conf
   Active: failed (Result: exit-code) since Mon 2016-09-26 14:40:35 CEST; 1min 33s ago
     Docs: man:systemd-sysv-generator(8)
  Process: 2183 ExecStop=/etc/init.d/apache2 stop (code=exited, status=0/SUCCESS)
  Process: 2490 ExecStart=/etc/init.d/apache2 start (code=exited, status=1/FAILURE)

Sep 26 14:40:35 Asterisk apache2[2490]:  * The apache2 configtest failed.
Sep 26 14:40:35 Asterisk apache2[2490]: Output of config test was:
Sep 26 14:40:35 Asterisk apache2[2490]: [Mon Sep 26 14:40:35.250008 2016] [:crit] [pid 2501:tid 140245312874368] Apache is running a threaded MPM, but your PHP Module is not compiled to be threadsafe.  You need to recompile PHP.
Sep 26 14:40:35 Asterisk apache2[2490]: AH00013: Pre-configuration failed
Sep 26 14:40:35 Asterisk apache2[2490]: Action 'configtest' failed.
Sep 26 14:40:35 Asterisk apache2[2490]: The Apache error log may have more information.
Sep 26 14:40:35 Asterisk systemd[1]: apache2.service: Control process exited, code=exited status=1
Sep 26 14:40:35 Asterisk systemd[1]: Failed to start LSB: Apache2 web server.
Sep 26 14:40:35 Asterisk systemd[1]: apache2.service: Unit entered failed state.
Sep 26 14:40:35 Asterisk systemd[1]: apache2.service: Failed with result 'exit-code'.

My error log (What I think it is my Error Log) http://hastebin.com/axalecoves.rb

I'm using a Ubuntu Server, running 16.04.1. If any of you know what I am doing wrong, please do help me. This happens whenever I run the sudo a2enmod php7.0 command. When I do a2dismod php7.0I can start it again just fine... As I said, if anyone knows anything about this, please do help me :)

  • Moved my "answer" to the comments which makes more sense ... That's a first hint Apache is running a threaded MPM, but your PHP Module is not compiled to be threadsafe. You need to recompile PHP. But to be sure pay attention to the line saying The Apache error log may have more information.Could you please show us the content of the apache error log? – derdeagle Sep 26 '16 at 12:57
  • hastebin.com/iganelojor.rb - I believe that is the log. – ApplePie Sep 26 '16 at 12:59
1

As said by Wiki Archlinux:

You need to replace mpm_event_module with mpm_prefork_module.
Open file /etc/httpd/conf/httpd.conf and edit like follows:

#LoadModule mpm_event_module modules/mod_mpm_event.so
LoadModule mpm_prefork_module modules/mod_mpm_prefork.so

Then restart Apache Service.

  • I don't have any httpd folder. Do you know why? – ApplePie Sep 26 '16 at 13:14
  • Try with /etc/apache2/apache2.conf. Otherwise use: a2dismod mpm_event and a2enmod mpm_prefork, service apache2 restart. – Echoes_86 Sep 26 '16 at 13:22
  • Where would I place the LoadModule command though? – ApplePie Sep 26 '16 at 13:27
  • Nevermind. What you told me works ;) Thanks man! – ApplePie Sep 26 '16 at 13:27
  • You're welcome :) Btw those commands create a symlink in the mods-enabled folder, in such a way enabling the mode chosen. If you resolved the case, accept my answer ;) – Echoes_86 Sep 26 '16 at 13:44

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.