I am trying to install PHP v8.0.2 on an Alpine Linux, but I get the following message:
apk add php8=8.0.2
fetch https://dl-cdn.alpinelinux.org/alpine/v3.13/main/x86_64/APKINDEX.tar.gz
fetch https://dl-cdn.alpinelinux.org/alpine/v3.13/community/x86_64/APKINDEX.tar.gz
ERROR: unable to select packages:
php8-8.0.6-r0:
breaks: world[php8=8.0.2]
Is there any way I can get it to install?
If I just do apk add php8
it adds version 8.0.6
, but there is an issue on that version that breaks my site.
Any help would be greatly appreciated
3
Answers
maybe u can install php from source, since it’s hard to find a specific version of php and install that using apt-get or yum install. And here is the source code of php 8.0.2:
source code of php 8.0.2
And the following article will give u some instructions of how to do that.It is php 7 installation, but the method is kinda same. Here is the articlel:
https://blacksaildivision.com/php-install-from-source
It is impossible via apk, as the Alpine Linux team are not keeping "older versions" in their current repositories (as stated here (gitlab.alpinelinux.org) and here (stschindler.medium.com))
So you have to go the way Richard Wan proposed and build it from source, if you can’t make your site running with php 8.0.6 or 7.4.19.
The PHP official Dockerhub page has version tags for official PHP versions in various flavors.
For the PHP 8.0.2 Alpine image, you could use
php:8.0.2-alpine3.12
as your base image, instead ofalpine:3.13
.For other PHP 8.0.2 Alpine 3.12 based images, see:
https://hub.docker.com/_/php?tab=tags&page=1&ordering=last_updated&name=8.0.2