Apache2.service falhou no Ubuntu

0

Estou tentando reiniciar o servidor apache2 e usei o comando abaixo e estou recebendo este erro

$ sudo service apache2 restart

Saída

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

Depois disso, digitei os comandos como dados acima "systemctl status apache2.service" e "journalctl -xe" e obtive essas saídas, mas não consigo entendê-lo.

$ systemctl status apache2.service

Saída

● 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 Tue 2017-02-07 11:38:36 IST; 19s ago
     Docs: man:systemd-sysv-generator(8)
  Process: 9552 ExecStart=/etc/init.d/apache2 start (code=exited, status=1/FAILURE)

Feb 07 11:38:36 Aspire-5742Z apache2[9552]:  * The apache2 configtest failed.
Feb 07 11:38:36 Aspire-5742Z apache2[9552]: Output of config test was:
Feb 07 11:38:36 Aspire-5742Z apache2[9552]: AH00526: Syntax error on line 9 of /etc/apache2/mods-enabled/php5.6.conf:
Feb 07 11:38:36 Aspire-5742Z apache2[9552]: Invalid command 'Require', perhaps misspelled or defined by a module not included in the server con
Feb 07 11:38:36 Aspire-5742Z apache2[9552]: Action 'configtest' failed.
Feb 07 11:38:36 Aspire-5742Z apache2[9552]: The Apache error log may have more information.
Feb 07 11:38:36 Aspire-5742Z systemd[1]: apache2.service: Control process exited, code=exited status=1
Feb 07 11:38:36 Aspire-5742Z systemd[1]: Failed to start LSB: Apache2 web server.
Feb 07 11:38:36 Aspire-5742Z systemd[1]: apache2.service: Unit entered failed state.
Feb 07 11:38:36 Aspire-5742Z systemd[1]: apache2.service: Failed with result 'exit-code'.

Entrada

$ journalctl -xe

Saída

-- Subject: Unit apache2.service has begun start-up
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
-- 
-- Unit apache2.service has begun starting up.
Feb 07 11:38:36 Aspire-5742Z apache2[9552]:  * Starting Apache httpd web server apache2
Feb 07 11:38:36 Aspire-5742Z apache2[9552]:  *
Feb 07 11:38:36 Aspire-5742Z apache2[9552]:  * The apache2 configtest failed.
Feb 07 11:38:36 Aspire-5742Z apache2[9552]: Output of config test was:
Feb 07 11:38:36 Aspire-5742Z apache2[9552]: AH00526: Syntax error on line 9 of /etc/apache2/mods-enabled/php5.6.conf:
Feb 07 11:38:36 Aspire-5742Z apache2[9552]: Invalid command 'Require', perhaps misspelled or defined by a module not included in the server con
Feb 07 11:38:36 Aspire-5742Z apache2[9552]: Action 'configtest' failed.
Feb 07 11:38:36 Aspire-5742Z apache2[9552]: The Apache error log may have more information.
Feb 07 11:38:36 Aspire-5742Z systemd[1]: apache2.service: Control process exited, code=exited status=1
Feb 07 11:38:36 Aspire-5742Z systemd[1]: Failed to start LSB: Apache2 web server.
-- Subject: Unit apache2.service has failed
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
-- 
-- Unit apache2.service has failed.
-- 
-- The result is failed.
Feb 07 11:38:36 Aspire-5742Z systemd[1]: apache2.service: Unit entered failed state.
Feb 07 11:38:36 Aspire-5742Z systemd[1]: apache2.service: Failed with result 'exit-code'.
Feb 07 11:38:36 Aspire-5742Z sudo[9546]: pam_unix(sudo:session): session closed for user root
Feb 07 11:39:01 Aspire-5742Z CRON[9571]: pam_unix(cron:session): session opened for user root by (uid=0)
Feb 07 11:39:01 Aspire-5742Z CRON[9572]: (root) CMD (  [ -x /usr/lib/php/sessionclean ] && if [ ! -d /run/systemd/system ]; then /usr/lib/php/s
Feb 07 11:39:01 Aspire-5742Z CRON[9571]: pam_unix(cron:session): session closed for user root
Feb 07 11:39:17 Aspire-5742Z systemd[1]: Starting Clean php session files...
-- Subject: Unit phpsessionclean.service has begun start-up
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
-- 
-- Unit phpsessionclean.service has begun starting up.
Feb 07 11:39:18 Aspire-5742Z systemd[1]: Started Clean php session files.
-- Subject: Unit phpsessionclean.service has finished start-up
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
-- 
-- Unit phpsessionclean.service has finished starting up.
-- 
-- The start-up result is done.

Entrada

$ apachectl -t

Saída

AH00526: Syntax error on line 9 of /etc/apache2/mods-enabled/php5.6.conf:
Invalid command 'Require', perhaps misspelled or defined by a module not included in the server configuration
Action '-t' failed.
The Apache error log may have more information.

Como posso corrigir isso. Obrigado antecipadamente.

    
por Clueless_programmer 07.02.2017 / 07:29

2 respostas

1

Parece que você está atualizando do Apache 2.2 para o 2.4, conforme descrito aqui , ativar mod_access_compat com

sudo a2enmod access_compat && sudo service apache2 restart

ou atualize diretivas para a versão 2.4.

    
por bistoco 07.02.2017 / 08:19
0

Antes de iniciar o apache, você deve usar apachectl -t certificando-se de que sua configuração passe nas verificações de sintaxe - o que parece ser o problema agora.

Considerando sua mensagem de erro, acho que você está perdendo mod_authz_core . Você pode conseguir corrigir com a2enmod authz_core . Você pode estar perdendo outros módulos, verifique apachectl -t output e pergunte ao google sobre uma diretiva do apache que corresponde a uma falha na verificação de sintaxe, ...

    
por SYN 07.02.2017 / 07:38