PHP 7 e apache exibe texto sem formatação e não pode ser reiniciado

3

Acabei de mudar para o Ubuntu do Windows e estou tentando fazer com que o PHP 7 e o Apache funcionem.

Estou executando o php 7 e o apache 2.4.18

PHP 7.0.4-7ubuntu2.1 (cli) ( NTS )
Server version: Apache/2.4.18 (Ubuntu)

O localhost do Apache exibe o "Funciona!" página, mas qualquer outra página com php mostra texto simples.

Depois de tentar reiniciar o serviço (sudo service apache2 restart) recebo o seguinte.

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

"systemctl status apache2.service" retorna,

May 31 11:11:12 mike-N53Jq apache2[4926]:  * The apache2 configtest failed.
May 31 11:11:12 mike-N53Jq apache2[4926]: Output of config test was:
May 31 11:11:12 mike-N53Jq apache2[4926]: [Tue May 31 11:11:12.775675 2016] [:crit] [pid 4936:tid 140137086609280] Apache is running a threa
May 31 11:11:12 mike-N53Jq apache2[4926]: AH00013: Pre-configuration failed
May 31 11:11:12 mike-N53Jq apache2[4926]: Action 'configtest' failed.
May 31 11:11:12 mike-N53Jq apache2[4926]: The Apache error log may have more information.
May 31 11:11:12 mike-N53Jq systemd[1]: apache2.service: Control process exited, code=exited status=1
May 31 11:11:12 mike-N53Jq systemd[1]: Failed to start LSB: Apache2 web server.
May 31 11:11:12 mike-N53Jq systemd[1]: apache2.service: Unit entered failed state.
May 31 11:11:12 mike-N53Jq systemd[1]: apache2.service: Failed with result 'exit-code'.

E o journalctl -xe retorna,

May 31 11:11:12 mike-N53Jq apache2[4926]: Output of config test was:
May 31 11:11:12 mike-N53Jq apache2[4926]: [Tue May 31 11:11:12.775675 2016] [:crit] [pid 4936:tid 140137086609280] Apache is running a threa
May 31 11:11:12 mike-N53Jq apache2[4926]: AH00013: Pre-configuration failed
May 31 11:11:12 mike-N53Jq apache2[4926]: Action 'configtest' failed.
May 31 11:11:12 mike-N53Jq apache2[4926]: The Apache error log may have more information.
May 31 11:11:12 mike-N53Jq systemd[1]: apache2.service: Control process exited, code=exited status=1
May 31 11:11:12 mike-N53Jq 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.
May 31 11:11:12 mike-N53Jq systemd[1]: apache2.service: Unit entered failed state.
May 31 11:11:12 mike-N53Jq systemd[1]: apache2.service: Failed with result 'exit-code'.
May 31 11:11:12 mike-N53Jq sudo[4920]: pam_unix(sudo:session): session closed for user root
May 31 11:11:18 mike-N53Jq pkexec[4951]: pam_unix(polkit-1:session): session opened for user root by (uid=1000)
May 31 11:11:18 mike-N53Jq pkexec[4951]: pam_systemd(polkit-1:session): Cannot create session: Already running in a session
May 31 11:11:18 mike-N53Jq pkexec[4951]: mike: Executing command [USER=root] [TTY=unknown] [CWD=/home/mike] [COMMAND=/usr/lib/update-notifie
May 31 11:17:01 mike-N53Jq CRON[5011]: pam_unix(cron:session): session opened for user root by (uid=0)
May 31 11:17:01 mike-N53Jq CRON[5012]: (root) CMD (   cd / && run-parts --report /etc/cron.hourly)
May 31 11:17:01 mike-N53Jq CRON[5011]: pam_unix(cron:session): session closed for user root

Alguém tem alguma sugestão sobre para onde ir a partir daqui? Isso tudo é muito novo para mim.

Obrigado.

    
por Aptorian 31.05.2016 / 20:22

2 respostas

7

Execute o seguinte comando no terminal

sudo apt-get install libapache2-mod-php

    
por vatz88 05.12.2016 / 07:32
0
sudo apt install php libapache2-mod-php
sudo apt install php7.0-mbstring
sudo a2dismod mpm_event
sudo a2enmod mpm_prefork
service apache2 restart

depois disso

gedit /etc/apache2/apache2.conf

adicione a seguinte linha

Inclua /etc/phpmyadmin/apache.conf

serviço apache2 restart

libapache2-mod-php do lado do servidor, linguagem de script embutida em HTML (módulo Apache 2), então temos que adicionar isso

    
por Abhishek Kumar 06.04.2018 / 07:38