2
votes

I've recentlly got a problem with my local virtual hosts after installing php 5.6 next to php 7.0. I'm using Ubuntu 16.04 with Apache, MySQL etc. configured for Laravel projects and everything was working perfectly fine with php 7.0 until I had to work with another project. This non-laravel project required php 5.6 to work, so I installed it next to php 7.0 together with some modules for phpmyadmin (as it didn't work after I switched server to php 5.6). So what I did after installing php 5.6 was:

sudo a2dismod php7.0
sudo a2enmod php5.6
sudo service apache2 restart

Added a new host for my php 5.6 project in /etc/hosts as 127.0.0.1 www.myhost.local.

Added a new config in sites-available, enabled it, restarted the server.

Installed few required by phpmyadmin modules to configure database for the new project.

Worked with my php 5.6 project.

When I wanted to switch back to my Laravel projects I made:

sudo a2dismod php5.6
sudo a2enmod php7.0
sudo service apache2 restart

And none of the laravel hosts worked. The error I get from Google Chrome is:
This site can’t be reached
www.myhost.local’s server IP address could not be found.
ERR_NAME_NOT_RESOLVED

And I DIDN'T CHANGE configs of Laravel projects! I didn't edit neither sites-availavle configs, nor etc/hotst except for adding the line with my php 5.6 project. I've tryed:

  1. Checking /etc/apache2/mods-enabled where are php7.0.load and php7.0.conf enabled.
  2. Checking service apache2 status and got Apache active (running).
  3. Checking http://localhost/ and got the default apache page.
  4. Checking http://localhost/php.info which showed me that server is running with php 7.0
  5. Deleting php 5.6 host from etc/hosts and disabling same config in sites-available.
  6. Adding < VirtualHost 127.0.0.1:80 > instead of < VirtualHost *:80 > in the beginning of my Laravel host config. Which made some inner pages work if loaded without www and home page still didn't and www was added to url every time I tryed to load it. However some inner pages began later to generate www too and nothing helped :(
  7. Checking apache logs and got warnings only.
  8. Some other minor things I can't remember now...

Can anyone help please? Or is it easier to reinstall php completely?

1
Is nothing written to the access logs? Then the server itself cannot be reached - are you sure that the address you are using is properly resolved?Nico Haase
@NicoHaase when I checked apache error.log on friday I had warnings like [mpm_prefork:notice] [pid 32397] AH00169: caught SIGTERM, shutting down.. and some others with SIGTERM. Now it's a complete mess as I also get permissions warnings re laravel project /storage folder. Which is understandable but a). Why did these permissions change b). Only one project is mentioned in logs c). Somehow when I try to open localhost/php.info now I get this exactrly laravel project page with 404 error. This project's host is the first one in /etc/hosts list after 127.0.0.1 and 127.0.1.1.Olga.D
what version of Laravel are your sites running in? Any version greater or equal to 5.5 needs > PHP 7Rooneyl
@Rooneyl i'm using Laravel 5.5.32. I'm really thinking of reinstalling php, but I'm sightly afraid of installing newer php versions next to existing ones.. as all my laravel sites worked fine until I've installed php 5.6 and configured the new non-laravel project :(Olga.D

1 Answers

0
votes

Thanks everyone! That was browser cache (although I've checked other browsers I never opened my projects in). So it finally worked in incognito window and after I cleared Chrome's and FF's cache.