Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Make PHP 7 run on Apache instead of 5.6 with Scotch Box / Vagrant

I've installed Scotch Box and updated the PHP version to PHP7. However, it seems like I've updated the PHP CLI, not the PHP version that Apache uses. I see other answers on SO saying that in the Apache httpd.conf there's a line that says loadModule php5 or something. I've checked it and in my httpd.conf it doesn't say anything about loadModule at all.

I did see that PHP7 is installed in a path with /cli/ in it, while PHP 5.6 is installed in a path with /apache2/ or apache in it.

In short, how do I get PHP7 to work on Apache installed on Scotch Box?

like image 736
erol_smsr Avatar asked Feb 22 '17 23:02

erol_smsr


1 Answers

I use vagrant,and i use ubuntu as my OS,so i just use apt-get to install the php7...in my experience,you can switch the php version using:

sudo update-alternatives --query php
sudo update-alternatives --set php /usr/bin/php7

if it didn't work ,you can try this:

sudo a2dismod php5.6
sudo a2enmod php7.0
like image 109
JWang Avatar answered Oct 06 '22 00:10

JWang