laravel / homestead

MIT License
3.86k stars 1.45k forks source link

On Apache type:, multiple php versions fail to map more than one site correctly #630

Closed narration-sd closed 7 years ago

narration-sd commented 7 years ago

Versions

Host operating system

Homestead.yaml

ip: 192.168.10.15 memory: 2048 cpus: 1 provider: virtualbox authorize: ~/.vagrantssl/id_rsa.pub keys:

sites:

databases:

Vagrant up output

https://gist.github.com/narration-sd/21158af0a0aef7cd34834ca399901a0b

Expected behavior

I should get two sites, sch.dev and sch2.dev, one running php5.6 apache, the other php7.0 apache

Actual behavior

Both sites run php5.6 apache, according to phpinfo() and actual site content reaction

Steps to reproduce

  1. just try the sites, run a phpinfo() command from a tiny script on each.
  2. I note this line in the vagrant up log; may be relevant or not:

    ==> sch.dev: libapache2-mod-php7.0: php5.6 module already enabled, not enabling PHP 7.0

  3. verified that this goes wrong only with type: apache. With no type: specification, thus nginx, the php versions come out properly, per site.

References

https://github.com/laravel/homestead/issues/625 -- using the workaround vaguely noted in #625, via some explanation of syntax here: https://laravel.com/docs/5.4/homestead#site-parameters

svpernova09 commented 7 years ago

unfortunately this is going to be an apache limitation since PHP version is a server configuration VS nginx a site configuration option.

We should get something added to the Docs that mentions this. (Probably). Sorry for the issues!

narration-sd commented 7 years ago

@svpernova09 Understood, as things stand, but here are several notes on people actually doing this, mostly around fastcgi.

It would certainly be great that Homestead supported this, hope you would agree, as people need to use it to try out deployment situations, many of which don't move from Apache, however advantageous Nginx.

I'll put the phpfarm one first; not sure if it isn't a simplifying layer for fastcgi:

svpernova09 commented 7 years ago

@narration-sd I totally get it, and I'm sorry for the frustration, but at the moment it's not an easily feasible option. Compiling PHP versions is just another step outside of what's going to be easy maintainable for me for Homestead. Sticking to PPAs is what makes this entire project a lot easier to handle.

My best recommendation would be installing Homestead per project per each version of PHP you need and run each of those on their own version of PHP.

narration-sd commented 7 years ago

@svpernova09 Ok, Joe, and do appreciate the profusion issue.

What about just doing php5.6 plus whatever the latest php7 is? That one is still quite important in view of legacy hosting sites, which move very slowly as you will know?

That Sury guy has a 5.6 ppa, and has been very good about keeping it up, even with sort of edge things as the php5.6-sybase (which is dblib to access mssql databases) that I need....

svpernova09 commented 7 years ago

The primary thing I want to avoid is compiling PHP for Homestead. It's so much easier to debug knowing that PHP is coming from a PPA and Ondřej is the gold standard. Atm we're actually supporting old versions of PHP in 2 ways, old versions of PHP where I maintain a personal box for 5.x and official Homestead box versions for 7.0.

I'm just at my limit it what I can support with the best user experience for Homestead.

narration-sd commented 7 years ago

Ok, thanks for listening, Joe, and very much appreciated to use Homestead, especially in its recent form.

Not having a central vm has made matters much smoother, faster, and generally enjoyable -- thanks.

svpernova09 commented 7 years ago

Thanks for the kind words, it certainly makes it worth it :D

I hate to say no to stuff, especially knowing it'll help people, but we have to balance that with what keeps it easy to maintain across 3 OS's and 3 providers.

Cheers.

narration-sd commented 7 years ago

Yeah, I know :)

You take care, Joe -- Clive

piotr-cz commented 6 years ago

Is the compiling step really required? @narration-sd check my https://github.com/laravel/homestead/issues/756#issuecomment-350548939 to see how to switch default php version

alpham8 commented 6 years ago

That's not true. You could run multiple php verisons inside different apache sites using php-fpm.

We did it already in our production environment. So, please fix it in homestead, too.

svpernova09 commented 6 years ago

We did it already in our production environment. So, please fix it in homestead, too.

Pull requests are always welcome.