Erro ao ligar/religar o apache2 [RESOLVIDO]

1. Erro ao ligar/religar o apache2 [RESOLVIDO]

Roger Diemer
DRLinux

(usa Ubuntu)

Enviado em 05/12/2017 - 09:53h

Prezados amigos, ainda iniciante no Linux, instalei todos os pacotes para levantar um servidor Lamp.
Acontece que não consigo acessar o localhost de nenhuma maneira e , ao tentar religar o apache aparece a seguinte mensagem de erro:

roger@roger-G31M-ES2C:~$ /etc/init.d/apache2 restart
/etc/init.d/apache2: linha 1: erro de sintaxe próximo do `token' não esperado `('
/etc/init.d/apache2: linha 1: `<?php phpinfo(); ?>'


Não entendi o erro de sintaxe , nem o porque de mencionar o script phpinfo.
Desde já agradeço!


  


2. MELHOR RESPOSTA

Higor da Silva Lopes
ThinKing

(usa Debian)

Enviado em 05/12/2017 - 10:35h

primeiro de tudo desculpa sua versão do PHP com o código:
php -v 

Se tiver algo dentro da pasta www faça um backup de tudo, logo após desinstale o apache2 e o php utilizando a seguinte linha de comando:
apt-get purge apache2 php7.0 

depois instale novamente utilizando:
apt-get update && apt-get install apache2 php7.0 


Logo após a instalação entre dentro do arquivo /etc/php/apache/php.ini
troque a linha
display_errors = off 
para
display_errors = on 

dê um restart no apache2
sudo /etc/init.d/apache2 restart 

e pronto, espero que dê certo.

3. Re: Erro ao ligar/religar o apache2 [RESOLVIDO]

Roger Diemer
DRLinux

(usa Ubuntu)

Enviado em 05/12/2017 - 10:39h

Galera, eu mesmo consegui dar um jeito aqui.
Não sei explicar porque, mas funcionou.

dei os comandos:
#apt-get purge apache2

#apt-get install apache2

#/etc/init.d/apache2 reload

#/etc/init.d/apache2 start

roger@roger-G31M-ES2C:~$ sudo /etc/init.d/apache2 start
[ ok ] Starting apache2 (via systemctl): apache2.service.
roger@roger-G31M-ES2C:~$ sudo /etc/init.d/apache2 status
&#9679; apache2.service - LSB: Apache2 web server
Loaded: loaded (/etc/init.d/apache2; bad; vendor preset: enabled)
Drop-In: /lib/systemd/system/apache2.service.d
&#9492;&#9472;apache2-systemd.conf
Active: active (running) since Ter 2017-12-05 10:22:06 BRST; 5min ago
Docs: man:systemd-sysv-generator(8)
Process: 2195 ExecReload=/etc/init.d/apache2 reload (code=exited, status=0/SUCCESS)
Process: 1024 ExecStart=/etc/init.d/apache2 start (code=exited, status=0/SUCCESS)
CGroup: /system.slice/apache2.service
&#9500;&#9472;1168 /usr/sbin/apache2 -k start
&#9500;&#9472;2211 /usr/sbin/apache2 -k start
&#9492;&#9472;2212 /usr/sbin/apache2 -k start

Dez 05 10:22:01 roger-G31M-ES2C systemd[1]: Starting LSB: Apache2 web server...
Dez 05 10:22:01 roger-G31M-ES2C apache2[1024]: * Starting Apache httpd web ...2
Dez 05 10:22:05 roger-G31M-ES2C apache2[1024]: AH00558: apache2: Could not r...e
Dez 05 10:22:06 roger-G31M-ES2C apache2[1024]: *
Dez 05 10:22:06 roger-G31M-ES2C systemd[1]: Started LSB: Apache2 web server.
Dez 05 10:27:24 roger-G31M-ES2C systemd[1]: Reloading LSB: Apache2 web server.
Dez 05 10:27:24 roger-G31M-ES2C apache2[2195]: * Reloading Apache httpd web...2
Dez 05 10:27:24 roger-G31M-ES2C apache2[2195]: *
Dez 05 10:27:24 roger-G31M-ES2C systemd[1]: Reloaded LSB: Apache2 web server.
Dez 05 10:27:41 roger-G31M-ES2C systemd[1]: Started LSB: Apache2 web server.
Hint: Some lines were ellipsized, use -l to show in full.







Patrocínio

Site hospedado pelo provedor RedeHost.
Linux banner

Destaques

Artigos

Dicas

Tópicos

Top 10 do mês

Scripts