This question has been asked multiple times but non of them worked for me. I need to change my terminal's version to 7.4.
When I do phpinfo()
it gives 7.4.10 but in terminal php -v
it always show 5.6.0
I've done:
$ sudo a2dismod php5.6
$ sudo a2enmod php7.4
$ sudo service apache2 restart
set PATH="/usr/bin/php7.4/bin:$PATH"
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 --config php
This show below result:
Recent versions of PHP aren't available for install, because the LTS (Long Term Support) versions of that version 18 of Ubuntu, and other derivatives, are now expired.
Upgrading the system won't work either, up to a point, dependencies are missing. Upgrading from
apt
won't work in this situation, neitherupdate-alternatives
as the remote PPA will block further installation on expired LTS systems.There is no proper solutions beside a fresh install of a supported recent LTS version.
However, to force install the last PHP versions, including the last development versions, we have to compile from sources.
This is really not recommended in a production server.
Get the last source archive from the PHP website:
https://www.php.net/downloads.php (See readme.md for tweaks)