简体   繁体   中英

How to update PHP version in homestead

I am having a trouble on updating php version in homestead. When I check the version in homestead ssh it says it's php version is PHP 5.6.23-1+deprecated+dontuse+deb.sury.org~trusty+1 (cli) . Now I would like to update the PHP version to 7 for code compatibility. Is there an easy way how to fix this?

I also tried this one from here but got no luck. Thanks

You have probably Laravel version 5.0 - https://laravel.com/docs/5.0/homestead , in this version Homestead has Ubuntu 14.04 and PHP 5.6. To update only PHP to 7.0, you need log into the Homestead, and execute:

sudo add-apt-repository ppa:ondrej/php
sudo apt-get update
sudo apt-get -y install php7.0-mysql php7.0-fpm php7.0-mbstring php7.0-xml php7.0-curl

Then you need change fastcgi_pass in you configuration files in /etc/nginx/sites-available/* to this fastcgi_pass unix:/var/run/php/php7.0-fpm.sock;

and at the end restart services:

/etc/init.d/nginx restart
/etc/init.d/php7.0-fpm restart

Upgrade the laravel/homestead box itself

$ vagrant box update

ssh into the virtual machine

$ vagrant ssh

and upgrade everything

$ sudo apt-get update
$ sudo apt-get upgrade

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM