When working with multiple PHP versions and Apache on Ubuntu 16.04, managing version switching can be a challenge, especially for the command line. Here's how to navigate this seamlessly:
For an immediate switch, utilize the following commands:
sudo update-alternatives --config php sudo update-alternatives --config phar sudo update-alternatives --config phar.phar
To manually switch between PHP versions:
sudo update-alternatives --set php /usr/bin/php7.1 sudo update-alternatives --set phar /usr/bin/phar7.1 sudo update-alternatives --set phar.phar /usr/bin/phar.phar7.1
sudo update-alternatives --set php /usr/bin/php5.6
Remember to run sudo service apache2 restart to apply changes made to the Apache configuration.
以上是如何使用 Apache 在 Ubuntu 16.04 的命令列上切換 PHP 版本?的詳細內容。更多資訊請關注PHP中文網其他相關文章!