mpemburn
Posts: 4
Joined: Thu Jan 05, 2023 4:58 pm

Need help getting PHP 8.1 to install

Thu Jan 05, 2023 6:58 pm

Howdy!

I've got a Pi Zero W V1.1 running Bullseye, and I've been pulling my hair out trying to get PHP 8.1 installed. I was able to get 8.0.1 going, but I have a Laravel 9.x project that requires 8.1.

The sticking point is:

Code: Select all

sudo apt install php8.1
E: Unable to locate package php8.1
E: Couldn't find any package by glob 'php8.1'
This was preceded by:

Code: Select all

sudo apt install software-properties-common
sudo add-apt-repository ppa:ondrej/php
sudo apt update
Am I missing something?

Thanks!

Mark


mpemburn
Posts: 4
Joined: Thu Jan 05, 2023 4:58 pm

Re: Need help getting PHP 8.1 to install

Fri Jan 06, 2023 1:21 pm

Thanks for the link--I didn't find that one when googling.

I just tried it out and, after doing:

Code: Select all

sudo apt update

...and seeing that there were packages to upgrade, I did:

Code: Select all

sudo apt upgrade
.
It ended with "Illegal instruction", and then everything it tried returned "Illegal instruction". When I rebooted, it stopped with a kernel panic. {sigh}. I'll re-image it at try again.

Mark

NickJP
Posts: 11
Joined: Fri Jul 17, 2020 7:34 am

Re: Need help getting PHP 8.1 to install

Mon Jan 23, 2023 9:56 am

I have php 8.2.1 running on Bullseye using the repository at sury.org. See https://packages.sury.org/php/README.txt.

avijeet26
Posts: 3
Joined: Mon Mar 20, 2023 12:18 pm

Re: Need help getting PHP 8.1 to install

Mon Mar 27, 2023 9:38 am

It looks like the package for PHP 8.1 is not available in the default package repository for your Bullseye distribution. You may need to add a different package repository or build PHP 8.1 from source.

First, you can try adding the Debian Backports repository to your system by adding the following line to your /etc/apt/sources.list file:
deb http://deb.debian.org/debian bullseye-backports main
Then, run sudo apt update to update the package lists, and try installing PHP 8.1 again with:
sudo apt install -t bullseye-backports php8.1
If that doesn't work, you could try building PHP 8.1 from source. Here are the general steps:

Install the required dependencies for building PHP:
sudo apt-get update
sudo apt-get install build-essential libssl-dev libcurl4-openssl-dev libxml2-dev libreadline-dev libzip-dev
Download the PHP 8.1 source code from the official website:
wget https://www.php.net/distributions/php-8.1.0.tar.gz
tar -zxvf php-8.1.0.tar.gz
cd php-8.1.0
Configure the PHP build with the necessary options:
./configure --prefix=/usr/local/php --enable-mbstring --with-curl --with-openssl --with-readline --with-zip
Build and install PHP:
make
sudo make install
Verify that PHP is installed by running:
/usr/local/php/bin/php -v
Keep in mind that building PHP from source can be a more involved process than installing it from a package, and may require additional steps depending on your specific configuration.

Return to “Other programming languages”