The estate is installed by PHP7, but I need PHP5

The estate accidentally stopped working for me, so I tried to remove all this and reinstall, but it did not go well.

I have a “job” after a day and a half confusing my path through various problems. However, for reasons that I cannot understand, PHP 7 is now running in my Homestead field.

The instructions that I used had additional options for installing PHP 7, but I intentionally skipped this because we are in PHP 5.

In life, I cannot figure out how to fix this. Things I tried:

  • I destroyed and reinstalled the field several times.
  • I deleted the VirtualBox field several times and restarted it.
  • I tried installing v0.3.3 in a field based on a single sentence. (I also updated the homestead.rb script accordingly.) At some point, something failed during the installation process with php7.0-fpm: unrecognized service , and the configured sites returned 502 Bad Gateway errors.
  • After reinstalling with v.0.4.0, it started to "work" as I described (it serves sites, as expected, etc.), but with PHP 7.

The search for solutions constantly led to a dead end.

I'm just a dummy developer. :) Laravel, Vagrant, Homestead, all this makes my head hurt. I just want this to work again, so that I can return to my actual work. Any tips or alternative search paths to study this problem will be appreciated.

+6
source share
2 answers

I also went through this problem and solved it by installing the old harvest box v0.3.3, and I used the old version of the homestead installer, so I suggest deleting the current field v0.4.0 and deleting your estate folder will do the following:

 $vagrant box add laravel/homestead --box-version 0.3.3 

and then download the older version of the Homestead installer from git, I am using v2.1.8 , it works fine. Enjoy php 5.6 :)

+9
source

I had a similar problem when I tried to upgrade Homestead to the latest version of Homestead 7.0 and set it to run PHP 5.6 instead of PH7, which, according to various sources, is possible by adding a line to the .yaml file indicating the version of PHP.

 sites: - map: myproject.local to: /home/vagrant/Code/craven/public_html php: "5.6" 

In fact, when I tried to do this, I received a 502 CGI gateway error. Here is a summary of the steps I had to take to fix this:

1) SSH to the Homestead virtual machine.

 ssh vagrant@127.0.0.1 -p 2222 

Looking at the nginx error log in / var / log / nginx /, you will find that the PHP 5.6 files that the server is looking for do not exist.

You can get confirmation of this by looking at the executable files.

 ls -la /usr/bin/php* 

2) To install PHP 5.6, run

 sudo apt-get update sudo apt-get install php5.6-fpm 

You can confirm that php 5.6 service is running with the command

 service --status-all 

3) Once it all works, refresh the web page for your site, and now it should work. In my case, since I was working on a Laravel 4.2 site, I then installed Mcrypt:

 sudo apt-get install php5.6-mcrypt 

4) In order for my mysql database to be up and running, I also had to install mysql.

 sudo apt-get install php5.6-mysql 

And, of course, after all this, I had to re-import the contents of the database from the file that I exported before updating the Homestead box.

Please note that if you ever destroy and recreate the Homestead box, you will need to repeat all these steps again.

0
source

Source: https://habr.com/ru/post/1240462/


All Articles