PHP Installation 8 Debian 11
The following tutorial describes how to install PHP 8 In the Debian system 11
We will complete it in a few minutes with just a few commands.
We start the terminal and update the system:
1 | apt-get update -y |
We install the necessary packages with the command:
1 | apt-get install ca-certificates apt-transport-https software-properties-common -y |
The next step is to add the repository and download the GPG key
1 | echo "deb https://packages.sury.org/php/ $(lsb_release -sc) main" | tee /etc/apt/sources.list.d/sury-php.list |
1 | wget -qO - https://packages.sury.org/php/apt.gpg | apt-key add - |
We are updating packages:
1 | apt-get update -y |
We install php 8
1 | apt-get install php8.0 |
Command php -v it should show us already installed php 8
1 2 3 4 | PHP 8.0.10 (cli) (built: Aug 26 2021 16:06:19) ( NTS ) Copyright (c) The PHP Group Zend Engine v4.0.10, Copyright (c) Zend Technologies with Zend OPcache v8.0.10, Copyright (c), by Zend Technologies |
We install the necessary packages for php 8
1 | apt-get install php php-common php-xml php-gd php-mbstring php-tokenizer php-json php-bcmath php-zip -y |
Edit the php.ini file
1 | nano /etc/php/8.0/apache2/php.ini |
And we're making the following changes:
1 2 3 4 5 6 | upload_max_filesize = 32M post_max_size = 48M memory_limit = 256M max_execution_time = 600 max_input_vars = 3000 max_input_time = 1000 |
If we want to upgrade php from 7.4 na 8.0 we follow these steps:
Disabling php 7.4
1 | a2dismod php7.4 |
Launch php 8.0
1 | a2enmod php8.0 |
We reload the apache server:
1 | systemctl restart apache2 |