I installed Laravel 5.6, but it's not working because it requires PHP 7.2.
I use Ubuntu 17, and installed Apache 2 and PHP 7.2 (7.1, 7.0) but when I use phpinfo()
it shows php7.0.
So how can I config Apache and set php7.2 instead of php7.0?
问问题
8898 次
2 回答
7
首先,您必须php7.2
使用以下命令进行安装
sudo apt install python-software-properties
sudo add-apt-repository ppa:ondrej/php
sudo apt update
sudo apt install -y php7.2
sudo apt install libapache2-mod-php7.2 php7.2-cli php7.2-curl php7.2-intl php7.2-mysql php7.2-opcache php7.2-json php7.2-bz2 php7.2-mcrypt php7.2-xmlrpc php7.2-mbstring php7.2-soap php7.2-xml php7.2-zip
安装 php 后,您必须运行以下命令:
sudo update-alternatives --set php "/usr/bin/php7.2";
sudo update-alternatives --set "php-config" "/usr/bin/php-config7.2";
sudo a2dismod "php7.0"
sudo a2dismod "php5.6"
sudo a2enmod "php7.2"
sudo service apache2 restart
如果您安装了php7.2-dev
,那么您也应该运行以下命令:
sudo update-alternatives --set "phpize" "/usr/bin/phpize7.2";
于 2018-02-14T13:12:36.373 回答
1
运行以下命令已PHP 7.2
安装
sudo add-apt-repository ppa:ondrej/php
sudo apt-get update
sudo apt-get install php7.2-cli
之后,您可以运行以下命令来查看已安装的 PHP 版本:
php -v
于 2018-02-14T13:04:33.820 回答