Run the following commands to disable other PHP versions like (php 8.1, php7.4 etc) for Apache and command line. Let’s set PHP 5.6 as your default version for CLI and Apache2 both. But still you can install and Use php 5.6 on your Debian system if your application required PHP 5.6. It is strongly recommended to upgrade to higher PHP version like 7.4 or 8.1. The developers of PHP are no longer supporting PHP 5.6. This is more useful for compiling PHP modules using pecl. Note – The phpize7.4 and php-config7.4 command is available in php7.4-dev package. Command Line Interface:- sudo update-alternatives -set php /usr/bin/php7.4 sudo update-alternatives -set phar /usr/bin/phar7.4 sudo update-alternatives -set phar.phar /usr/bin/phar.phar7.4 sudo update-alternatives -set phpize /usr/bin/phpize7.4 sudo update-alternatives -set php-config /usr/bin/php-config7.4.sudo a2enmod php7.4 sudo service apache2 restart Now, enable PHP 7.4 module in Apache server. Run the following commands to disable Apache module for other PHP versions sudo a2dismod php8.1 php5.6 You can do this by disabling Apache2 modules for all other installed PHP versions and configure CLI using the update-alternatives command. You need to set PHP 7.4 as your active PHP version for CLI and Apache2 both. ![]() Note – The phpize8.1 and php-config8.1 command is available in php8.1-dev package. For Command Line Interface:- sudo update-alternatives -set php /usr/bin/php8.1 sudo update-alternatives -set phar /usr/bin/phar8.1 sudo update-alternatives -set phar.phar /usr/bin/phar.phar8.1 sudo update-alternatives -set phpize /usr/bin/phpize8.1 sudo update-alternatives -set php-config /usr/bin/php-config8.1.sudo a2enmod php8.1 sudo service apache2 restart Now, enable PHP 8.1 module in Apache server. Run the following command to disable Apache module for other PHP versions. You need to set PHP 8.1 as your active PHP version for CLI and Apache2 both. You can use the same for other PHP versions by changes commands accordingly. We have installed PHP 8.1, PHP 7.4 and PHP 5.6 on our Debian system. Read => How to Install PHP on Debian 10 via PPA.Read => How to Install PHP on Debian 11 via PPA.This tutorial will help you to switch between multiple PHP versions for Apache server and CLI on Debian. ![]() Now you need to switch the active PHP version for CLI and Apache2. We assume you have installed multiple PHP version on your Debian system. You can simply switch your PHP version to default used for Apache and command line. For any requirement, you need to use PHP 5.6. PHP 7.2 is running as default PHP for Apache and CLI. On your system, if you have installed multiple versions of PHP (eg PHP 8.1, 8.0, 7.4, 7.3, 7.2, 7.1 and 5.6).
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |