Default rasbian still ships with php7.0 even though that version in not supported any more. We will install the latest php 7.3. But because this is not the default we will need to do a few extra tweaks.
In the file
deb http://mirrordirector.raspbian.org/raspbian/ buster main contrib non-free rpi
After saving create the next file
sudo nano /etc/apt/preferences.d/10-buster. With the content:
Package: * Pin: release n=stretch Pin-Priority: 900 Package: * Pin: release n=buster Pin-Priority: 750
Again save. Make the system aware of this source list with
sudo apt update
Now we are ready to install PHP7 with all it’s modules:
sudo apt install -y -t buster php7.3-fpm php7.3-curl php7.3-gd php7.3-intl php7.3-mbstring php7.3-mysql php7.3-imap php7.3-opcache php7.3-sqlite3 php7.3-xml php7.3-xmlrpc php7.3-zip php-apcu
When done check it with
php -v it should show a PHP 7.3.. Now we need to add a few fpm things for nginx to work properly.
sudo nano /etc/php/7.3/fpm/conf.d/90-pi-custom.ini
cgi.fix_pathinfo=0 upload_max_filesize=64m post_max_size=64m max_execution_time=600
Finally reload php
sudo service php7.3-fpm reload
Now PHP is ready to use
You might want image optimization.
We have installed php-gp for that. But that is not enough.
sudo apt install -y optipng gifsicle libjpeg-progs