NOTE: Replace version number to update into any PHP version.
1. Add repository if not already added
sudo add-apt-repository ppa:ondrej/php # Press enter to confirm. sudo apt-get update
2. Install PHP 7.4
sudo apt install php7.4 php7.4-common php7.4-cli # Replace 7.4 with the version you are installing.
2.1. Install extensions
if you want to see what extensions that has already been installed.dpkg -l | grep php | tee packages.txtInstall extensions from the new version.
sudo apt install php7.4-curl php7.4-json php7.4-gd php7.4-mbstring php7.4-mysql php7.4-intl php7.4-bcmath php7.4-bz2 php7.4-readline php7.4-zip # Change 7.4 with the version you are installing.
3. Bind with Apache
Check how it's bound to Apache2apachectl -VIf it's mod_event,
sudo apt install php7.4-fpmIf it's prefork, which is commonly the case.
sudo apt install libapache2-mod-php7.4 sudo a2enmod php7.4
4. Uninstall old versions
sudo apt purge php7.3 libapache2-mod-php7.3 # Replace 7.3 with the version you had.
5. Check installation
php -v
No comments:
Post a Comment