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?


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
  • Comments are not for extended discussion; this conversation has been moved to chat. – goldilocks Feb 11 '20 at 16:48
  • resulted in Segmentation fault, can't autoremove it anymore :/ – clockw0rk Dec 28 '20 at 6:55
  • @clockw0rk Which method you've followed? – M. Rostami Dec 28 '20 at 7:29
  • 2
    The second one. Seems like there has changed a lot with php, wordpress and so on this year. switched to a different bloggin software now, since i could not even get nginx to install properly on raspian. they really should update the arm-package list – clockw0rk Dec 29 '20 at 2:00
  • You get my upvote. Followed method 2 in feb 2021 and got the expected results on raspberry os buster. It is always nice to see a good answer which explains each step. – Thomas Carlisle Feb 19 at 17:17

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.