LINUX, FOSS AND LIBRARY TECHNOLOGY ENTHUSIAST

Thursday, February 2, 2023

Install latest PHP on Debian

0 comments

The Debian default repository does not contain latest PHP. But it can be installed via PHP repository 


Why Debian system doesn't contain latest software?


Debian is a stable and reliable distribution that prioritizes stability and security over new software releases. The latest software may contain bugs or security vulnerabilities that have not been fully tested, and including them in the distribution could compromise the stability and security of the system. Instead, Debian focuses on thoroughly testing and integrating stable releases of software into their repositories, ensuring that users have access to high-quality and secure software.


Install file dependencies


sudo apt install -y gnupg2 ca-certificates apt-transport-https software-properties-common 


Add PHP repository


echo "deb https://packages.sury.org/php/ $(lsb_release -sc) main" | tee /etc/apt/sources.list.d/php.list


wget -qO - https://packages.sury.org/php/apt.gpg | apt-key add -


Install latest PHP and some modules ( at this time  8.0 is the latest version)


sudo apt update

sudo apt install -y php libapache2-mod-php php-pear php-cgi php-common php-mbstring php-zip php-net-socket php-gd php-mysql php-bcmath unzip wget git 


Now check the PHP version with this command


php -v



No comments:

Post a Comment