user3189734
user3189734

Reputation: 665

Laravel Homestead - older versions of PHP and Laravel

Is it possible to run homestead with an older version of PHP and Laravel 4.1? I need to set up my VM to replicate our production server, as closely as possible.

Upvotes: 3

Views: 2817

Answers (2)

Pathros
Pathros

Reputation: 10730

I find myself in 2021. According to the official docs and with the current Laravel homestead v10.17.0 you have the possibility to explicitly set the PHP version required right at the Homestead.yml file:

sites:
    - map: homestead.test
      to: /home/vagrant/project1/public
      php: "7.1"
    - map: project2.test
      to: /home/vagrant/project2/public
      php: "5.6"
    - map: default.test
      to: /home/vagrant/project1/public

Then, don't forget to apply the changes with

% vagrant provision

Moreover, you could change dynamically the PHP version used in your Laravel Homestead Ubuntu virtual machine

$ sudo update-alternatives --config PHP
$ php -i | grep "Loaded Configuration File"
$ php -v

But that only works for composer update, it doesn't seem to work for an application. So changing the Homestead.yml file is the way to go.

Upvotes: 1

Laurence
Laurence

Reputation: 60058

Homestead is just a prepackaged version of Vagrant with PHP5.6, ngnix, mySQL etc already installed and configurable.

If you need a specific environment that is "different" to Homestead, you just create your own Vagrant environment with a bashscript that installs the versions of software that closely matches your production environment.

This guide here provides specific information for Laravel - but any Vagrant guide will be able to help.

Upvotes: 0

Related Questions