11

I'm trying for about 4 hours to install PHP 7.4 on my Raspberry Pi Zero W.

I tried different tutorials, but I endup crashing my raspbian completly or just the installed php. With crashing I mean, I get the following message: Illegal instruction.

I also tried to install diffrent raspbians, but nothing worked till now.

Is it even possible to use PHP 7.4 on a raspberry pi?

Mr.Tr33
  • 229
  • 1
  • 2
  • 4

1 Answers1

22

First method:

You can install it manually by:

wget http://ftp.us.debian.org/debian/pool/main/p/php7.4/php7.4_7.4.1-1_all.deb 

And then:

dpkg -i php7.4_7.4.1-1_all.deb

It gives you a lot of dependencies which you must install before this package. It's the hardest method. Look at the second method which is much easier.


Second method:

Ensure your system is updated:

sudo apt update

Download and store the PPA repository in a file but first, download the GPG key:

sudo apt -y install lsb-release apt-transport-https ca-certificates

sudo wget -O /etc/apt/trusted.gpg.d/php.gpg https://packages.sury.org/php/apt.gpg

Then add the repository:

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

The last step is to install PHP 7.4 on your Raspbian Buster. Before installation, update the system package list on added repositories:

sudo apt update

Then install PHP 7.4:

sudo apt -y install php7.4  

I just tested it and worked. I got the exact version by php -v:

PHP 7.4.2 (cli) (built: Feb  2 2020 07:53:49) ( NTS )
Copyright (c) The PHP Group
Zend Engine v3.4.0, Copyright (c) Zend Technologies
    with Zend OPcache v7.4.2, Copyright (c), by Zend Technologies
Mohi Rostami
  • 4,434
  • 1
  • 20
  • 39