Y
Y
Yaroslav2020-06-21 13:51:59
Debian
Yaroslav, 2020-06-21 13:51:59

How to put PHP under a different architecture on Debian?

I want something strange:
Host machine with x86_64 architecture
Guest machine (LXC) is also x86_64. (Create with command:

sudo lxc-create -n php -t download -- --dist=debian --release=buster --arch=amd64
, so you can repeat exactly my situation).

I would like to install PHP for i386 (32bit, not 64bit) on the guest machine.

(Why such difficulties? Because in fact there is a production virtual machine with such a problem that needs to be brought into a divine form (it is all 64-bit, but by some miracle PHP from i386 is embedded there, don’t ask why). And before taking sharp razor and edit it, I want to play around on a test machine. Multiarch HOWTO seems to have read it)

On a virtual machine, I added the architecture to dpkg and sources.list:
[email protected]:/# arch
x86_64
[email protected]:/# dpkg --add-architecture i386
[email protected]:/# dpkg --print-foreign-architectures
i386
[email protected]:/# cat /etc/apt/sources.list
# Generated by distrobuilder
deb [arch=amd64,i386] http://deb.debian.org/debian buster main
deb [arch=amd64,i386] http://security.debian.org/debian-security buster/updates main


We put a test package:
# apt clean
# apt update
# apt install links:i386


Everything works great! Added links for i386. With all dependencies. Works.

But if I try to install php in the same way, it doesn't work:
##### Пробуем тупо сходу

roo[email protected]:/# apt install php-cli:i386             
Reading package lists... Done
Building dependency tree       
Reading state information... Done
Note, selecting 'php7.3-cli:i386' instead of 'php-cli:i386'
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:

The following packages have unmet dependencies:
 php7.3-cli:i386 : Depends: php7.3-common:i386 (= 7.3.14-1~deb10u1) but it is not going to be installed
                   Depends: php7.3-json:i386 but it is not going to be installed
                   Depends: php7.3-opcache:i386 but it is not going to be installed
                   Depends: php7.3-readline:i386 but it is not going to be installed
E: Unable to correct problems, you have held broken packages.


##### пробуем вручную

[email protected]:/# apt install php7.3-common:i386
Reading package lists... Done
Building dependency tree       
Reading state information... Done
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:

The following packages have unmet dependencies:
 php7.3-common:i386 : Depends: php-common:i386 (>= 1:35) but it is not installable
E: Unable to correct problems, you have held broken packages.


##### И еще вот так пробуем

[email protected]:/# apt install php7.3-common:i386 php-common:i386
Reading package lists... Done
Building dependency tree       
Reading state information... Done
Package php-common:i386 is not available, but is referred to by another package.
This may mean that the package is missing, has been obsoleted, or
is only available from another source

E: Package 'php-common:i386' has no installation candidate


How to stumble him? As I understand it, this package should be used: https://packages.debian.org/buster/php-common , it is without architecture (all), version 2:69 (that is, a different era - but it seems like it should satisfy the requirements).

If you put it with the command: apt install php-common:all - then it is put. But it still doesn't work:
[email protected]:/# apt install php7.3-common:i386                
...
 php7.3-common:i386 : Depends: php-common:i386 (>= 1:35) but it is not installable
E: Unable to correct problems, you have held broken packages.

For some reason, he requires php-common specifically for i386 (???), and even the installed all architecture package does not suit him.

Well, as a cherry: apt install php-cli:amd64- it works perfectly. And if you create an i386 virtual machine (arch shows i686), then php-cli will be fine. And it uses php-common version 2:69, architecture all. (That is, the same package, which was not suitable for dependencies, is now suitable)

If you download to disk and install via dpkg, then you can install a separate package:
[email protected]:/tmp# dpkg --force all -i php7.3-common_7.3.14-1~deb10u1_i386.deb 
...

But other packages still stumble, download all of them and install through --force all or what? There is a feeling that I'm doing something wrong, just "not turned on" the i386 somewhere?

Where am I stupid, how to install php-cli:i386 on a pure typical amd64 virtual machine? PHP packages not multiarch-aware? But somehow they were put on a server with a different architecture...

Answer the question

In order to leave comments, you need to log in

1 answer(s)
K
ky0, 2020-06-21
@ky0

It is necessary not to "take a sharp razor and edit", but in a calm environment try to recreate the same configuration on a new virtual machine where there is no zoo. I am almost sure that everything will take off on 64-bit PHP.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question