Install php8 # 1

# Step1 Update the system
sudo apt update 
sudo apt upgrade

Step2 add PPA to PHP8
sudo apt install software-properties-common 
sudo add-apt-repository ppa:ondrej/php 
sudo apt update

Install PHP 8 FPM for NginxSudo apt install php8.0 - FPMVerify that the installation is correctPHP - fpm8.0 - vInstall the PHP 8 extensionSudo apt install php8.0-common php8.0-mysql php8.0- XML php8.0-curl php8.0-gd php8.0-imagick php8.0-cli php8.0-dev Php8.0 -imap php8.0-mbstring php8.0-opcache php8.0-soap php8.0-zip -yConfigure PHP 8 for NginxSudo vim/etc/PHP / 8.0 / FPM/PHP iniRun the following command to modify the configurationSudo PHP -fpm8.0 -t sudo service php8.0-fpm restart sudo service nginx restartCopy the code
upload_max_filesize = 32M 
post_max_size = 48M 
memory_limit = 256M 
max_execution_time = 600 
max_input_vars = 3000 
max_input_time = 1000
Copy the code
Configure the PHP 8 FPM poolSudo vim/etc/PHP / 8.0 / FPM/pool. D/www.confRun the following command to modify the configurationSudo PHP -fpm8.0 -t sudo service php8.0-fpm restart sudo service nginx restartCopy the code
user = username 
group = username 
listen.owner = username 
listen.group = username
Copy the code
# step7 nginx configuration
sudo vim /etc/nginx/sites-available/your.conf
# will fastcgi_pass Unix: / run/PHP/php7.4 - FPM. The sock. Instead of
# fastcgi_pass Unix: / run/PHP/php8.0 - FPM. The sock.
# restart nginx
sudo nginx -t 
sudo service nginx restart
Copy the code

#2 Switch the PHP version

Step1 switch to the default PHP version in cli mode
sudo update-alternatives --config php

Step2 switch the phpize version
sudo update-alternatives --config phpize

Step3 switch the php-config version
sudo update-alternatives --config php-config

Check the current VERSION of PHP
php -v
Copy the code

Install Laravel8 # 3

#step1
curl -s https://laravel.build/gdj | bash
#step2 
cd gdj
./vendor/bin/sail up
Docker-compose: command not found: docker-compose: docker-compose: command not found
sudo apt install docker-compose

Copy the code