1

I just upgraded my Ubuntu 17.10 to 18.04 and php stopped working. I restarted apache and tried some solutions I found on the web such as

sudo a2enmod php7.1
sudo systemctl restart apache2

but still it doesn't work.

$ journalctl -xe -u apache2

-- Unit apache2.service has failed.
-- 
-- The result is RESULT.
-- Reboot --
Nis 29 02:31:21 hasan systemd[1]: Starting The Apache HTTP Server...
-- Subject: Unit apache2.service has begun start-up
-- Defined-By: systemd
-- Support: http://www.ubuntu.com/support
-- 
-- Unit apache2.service has begun starting up.
Nis 29 02:31:28 hasan apachectl[947]: apache2: Syntax error on line 146 of /etc/
Nis 29 02:31:28 hasan apachectl[947]: Action 'start' failed.
Nis 29 02:31:28 hasan apachectl[947]: The Apache error log may have more informa
Nis 29 02:31:28 hasan systemd[1]: apache2.service: Control process exited, code=
Nis 29 02:31:28 hasan systemd[1]: apache2.service: Failed with result 'exit-code
Nis 29 02:31:28 hasan systemd[1]: Failed to start The Apache HTTP Server.
-- Subject: Unit apache2.service has failed
-- Defined-By: systemd
-- Support: http://www.ubuntu.com/support
-- 
-- Unit apache2.service has failed.
-- 
-- The result is RESULT.

How can I fix this?

  • what does journalctl -xe -u apache2 say? – George Udosen Apr 28 '18 at 18:25
  • @GeorgeUdosen I edited my question – Hasan Tıngır Apr 28 '18 at 20:39
  • Please run this apache2ctl configtest, I see this apache2: Syntax error on line 146 of /etc/ in the journalctl logs. Please make sure nothing is left out! – George Udosen Apr 28 '18 at 20:43
2

I reinstalled php and now it works.

remove php completely

sudo apt-get purge php7.0-common
sudo apt-get --purge autoremove -y

then reinstall php 7.0

 sudo apt-get install php7.0 
  • could you tell us how you did that exactly? It could be helpful to others – Zanna Jul 16 '18 at 14:53
  • @Zanna I just removed and reinstalled php actually, not more – Hasan Tıngır Aug 6 '18 at 8:54

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.