phpenmod specific version of php code example

Example 1: php version command linux

# php -v
PHP 5.4.16 (cli) (built: Mar  7 2018 13:34:47) 
Copyright (c) 1997-2013 The PHP Group
Zend Engine v2.4.0, Copyright (c) 1998-2013 Zend Technologies

Example 2: debian php switch version

// Apache:
sudo a2dismod php5.6 php7.1 php7.0   ## Shows error for modules not installed 
sudo a2enmod php7.4
sudo service apache2 restart

// In case of issues disabling some modules use the following syntax
sudo a2dismod mpm_prefork
//--------------------------------------------------------------

// Command Line:
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

Example 3: update php version windows

Take a backup of your htdocs and data folder (subfolder of MySQL folder), reinstall upgraded version and replace those folders.

Note: In case you have changed config files like PHP (php.ini), Apache (httpd.conf) or any other, please take back up of those files as well and replace them with newly installed version.

Tags:

Php Example