Reputation: 81
In production I have two servers running php7.1 and php7.3. Other than the php-version, the environments are the same.
I'm trying to recreate this in homestead using different php-version for each site, but all sites end up using php 7.4 as it is the current version of the homestead box.
In other words, the site versioning have no effect:
Homestead.yaml
ip: "192.168.10.10"
memory: 2048
cpus: 2
provider: virtualbox
authorize: .ssh/homestead_rsa.pub
keys:
- .ssh/homestead_rsa
folders:
- map: C:/www/api
to: /home/vagrant/api
php: "7.3"
- map: C:/www/bikes
to: /home/vagrant/bikes
php: "7.1"
- map: C:/www/manager
to: /home/vagrant/manager
php: "7.3"
sites:
- map: api.test
to: /home/vagrant/api/public
- map: bikes.test
to: /home/vagrant/bikes/public
- map: manager.test
to: /home/vagrant/manager/public
databases:
- api
- bikes
- manager
Anyone got a clue what i'm doing wrong? Is there a bettwer way to do this? Like having multiple boxes?
I'm using Vagrant 2.2.6 and Homestead 9.2.0
Upvotes: 5
Views: 1735
Reputation: 369
I had this issue too. Phpmyadmin required php 8.0, and I had php 8.1.
After running sudo service --status-all | grep php
, it appeared that only one php-fpm service was up.
[ - ] php5.6-fpm
[ - ] php7.0-fpm
[ - ] php7.1-fpm
[ - ] php7.2-fpm
[ - ] php7.3-fpm
[ - ] php7.4-fpm
[ - ] php8.0-fpm
[ + ] php8.1-fpm
After running sudo service php8.0-fpm start
phpmyadmin worked fine. However after reboot service didn't start. So I set up Homestead.yaml to start desired service.
sites:
- map: homestead.test
to: /home/vagrant/projects/myproject/public
- map: phpmyadmin.test
to: /home/vagrant/projects/phpmyadmin/
php: "8.0"
databases:
- homestead
services:
- enabled:
- "php8.0-fpm"
After vagrant reload --provision
both php8.1-fpm and php8.0-fpm were up.
[ - ] php5.6-fpm
[ - ] php7.0-fpm
[ - ] php7.1-fpm
[ - ] php7.2-fpm
[ - ] php7.3-fpm
[ - ] php7.4-fpm
[ + ] php8.0-fpm
[ + ] php8.1-fpm
Upvotes: 6
Reputation: 144
You needs to move "php:" tag to sites section. And more, you must specify "type:" tag for each site.
Fix the code and run vagrant reload --provision.
ip: "192.168.10.10"
memory: 2048
cpus: 2
provider: virtualbox
authorize: .ssh/homestead_rsa.pub
keys:
- .ssh/homestead_rsa
folders:
- map: C:/www/api
to: /home/vagrant/api
- map: C:/www/bikes
to: /home/vagrant/bikes
- map: C:/www/manager
to: /home/vagrant/manager
sites:
- map: api.test
to: /home/vagrant/api/public
type: "apache"
php: "7.3"
- map: bikes.test
to: /home/vagrant/bikes/public
type: "apache"
php: "7.1"
- map: manager.test
to: /home/vagrant/manager/public
type: "apache"
php: "7.3"
databases:
- api
- bikes
- manager
Upvotes: 0