Search
 
SCRIPT & CODE EXAMPLE
 

PHP

switch php version ubuntu

# Interactive Way
sudo update-alternatives --config php
Comment

switch php version ubuntu

# From PHP 7.1 => PHP 5.6

#Apache
sudo a2dismod php7.1
sudo a2enmod php5.6
sudo service apache2 restart
 
 #command Line
 sudo update-alternatives --set php /usr/bin/php5.6
Comment

php version change ubuntu

sudo update-alternatives --config php
 select a version
Comment

change php version ubuntu

//In ubunutu
Default PHP 7.1 is set on your system and you need to switch to PHP 5.6

$ sudo a2dismod php7.1
$ sudo a2enmod php5.6
$ sudo service apache2 restart
  
sudo update-alternatives --set php /usr/bin/php5.6
Comment

change php version ubuntu

$ sudo update-alternatives --config php
 or
$ sudo a2enmod php7.1(version)
Comment

php change version linux

Interactive switching mode
sudo update-alternatives --config php
sudo update-alternatives --config phar
sudo update-alternatives --config phar.phar

Manual Switching
From PHP 5.6 => PHP 7.1
Default PHP 5.6 is set on your system and you need to switch to PHP 7.1.

Apache:

$ sudo a2dismod php5.6
$ sudo a2enmod php7.1
$ sudo service apache2 restart

Command Line:

$ 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
From PHP 7.1 => PHP 5.6
Default PHP 7.1 is set on your system and you need to switch to PHP 5.6.

Apache:

$ sudo a2dismod php7.1
$ sudo a2enmod php5.6
$ sudo service apache2 restart
Command Line:

$ sudo update-alternatives --set php /usr/bin/php5.6
Comment

change php version in ubuntu

sudo update-alternatives --config php
sudo update-alternatives --config phar
sudo update-alternatives --config phar.phar
Comment

change php version ubuntu

sudo update-alternatives --config php
Comment

change php version in linux

vim ~/.bashrc
alias phpchange=change_php

change_php(){
        CURRENT_PHP_VERSION=$(php -v | head -n 1 | cut -d " " -f 2 | cut -f1-2 -d"." 2>/dev/null)
        echo "Current PHP Version is ".$CURRENT_PHP_VERSION;
        sudo a2dismod php$CURRENT_PHP_VERSION;
        sudo a2enmod php$1;
        sudo update-alternatives --set php /usr/bin/php$1
        sudo service apache2 restart

}


and then run phpchange 7.0 // to switch to 7
make sure you need to have that version installed
Comment

change the php version in linux

sudo update-alternatives --set php /usr/bin/php7.2
sudo update-alternatives --set phar /usr/bin/phar7.2
sudo update-alternatives --set phar.phar /usr/bin/phar.phar7.2
sudo update-alternatives --set phpize /usr/bin/phpize7.2
sudo update-alternatives --set php-config /usr/bin/php-config7.2
Comment

switch php version ubuntu

$ 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
Comment

how switch php version in ubuntu

 sudo update-alternatives --set php /usr/bin/php5.6
Comment

Set version of php Ubuntu

sudo update-alternatives --set php /usr/bin/php5.6
Comment

change php version in ubuntu

$ sudo update-alternatives --set phar /usr/bin/phar5.6
Comment

change php version on ubuntu

alias setphp="sudo update-alternatives --config php;sudo update-alternatives --config phar; update-alternatives --config phar.phar; a2dismod php*.*;systemctl restart apache2"

  Put the above alias in the

  sudo nano ~/.bashrc
  
  #After the above command just run this command
  
  a2enmod php<Your Desired Version> # like, a2enmod php7.4
  
  Now you can run command "setphp" from your terminal.
Comment

ubuntu change php version

sudo a2dismod php7.1
sudo a2enmod php5.6
sudo service apache2 restart
 #command Line
 sudo update-alternatives --set php /usr/bin/php5.6
 
$ 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
Comment

PREVIOUS NEXT
Code Example
Php :: how to extract data from json in php 
Php :: php function to minify javascript and css 
Php :: Rename route resource in laravel 
Php :: laravel where and blade 
Php :: laravel validate change password 
Php :: laravel collection intersect 
Php :: PHP executable not found. Install PHP 7 and add it to your PATH or set the php.executablePath setting 
Php :: how to add javascript to a php variable 
Php :: php mysqli insert name adress 
Php :: catch warning php 
Php :: laravel migration mediumint length 
Php :: limit query codeiniter 3 
Php :: Alternatively, you may set the environment variables ONIG_CFLAGS and ONIG_LIBS to avoid the need to call pkg-config. 
Php :: how to add x-xss-protection header 
Php :: Update page template and remove page editor in wordpress 
Php :: create config value file in php 
Php :: storefront remove sidebar from product page 
Php :: Get PHP String Length 
Php :: acf get all choices from select 
Php :: adjacent post sort order by post title 
Php :: to list all relations of model laravel 
Php :: laravel @class 
Php :: heroku deploy php 
Php :: Wordpress pagination custom arrow 
Php :: @admin @endadmin 
Php :: require_once different on server 
Php :: hasmany relation in laravel 
Php :: php 7 The each() function is deprecated. 
Php :: How to remove from a multidimensional array all duplicate elements including the original 
Php :: laravel collection find 
ADD CONTENT
Topic
Content
Source link
Name
4+5 =