Issue
The PHP-compiler on my Raspberry Pi 4 is only using 32 bits instead of 64 bits. I double-checked my kernel-architecture. Everything is configured to 64 bits...
Do i need to add a additional configuration to compile 64 bit php-code?
PHP test (on my Raspberry Pi 4)
$php -r 'echo PHP_INT_MAX;'
2147483647 (32 bit)
PHP test (on my PC, 64 bit)
php -r 'echo PHP_INT_MAX;'
9223372036854775807 (64 bit)
PHP-Version (on my Raspberry Pi 4)
php -v
Result:
PHP 8.1.13 (cli) (built: Nov 26 2022 14:29:42) (NTS)
Copyright (c) The PHP Group
Zend Engine v4.1.13, Copyright (c) Zend Technologies
with Zend OPcache v8.1.13, Copyright (c), by Zend Technologies
unix name (on my Raspberry Pi 4)
uname -a
Linux raspberrypi 5.10.103-v8+ #1529 SMP PREEMPT Tue Mar 8 12:26:46 GMT 2022 aarch64 GNU/Linux
I already updated to PHP 8.1.13 without any effect.
EDIT after Comment of Siguza
file /bin/bash
bin/bash: ELF 32-bit LSB executable, ARM, EABI5 version 1 (SYSV), dynamically linked, interpreter /lib/ld-linux-armhf.so.3, for GNU/Linux 3.2.0, BuildID[sha1]=3e5e2847bbc51da2ab313bc53d4bdcff0faf2462, stripped
I am not sure, why this comment is printing out "ELF 32-bit LSB executable".
Edit after Comment of Nate Eldredge
hostnamectl
Static hostname: raspberrypi
Icon name: computer
Machine ID: 082e8c9e42614daa82110aXXXXXXXXXX
Boot ID: 95b916d95e7d47df92342XXXXXXXXXX
Operating System: Raspbian GNU/Linux 11 (bullseye)
Kernel: Linux 5.15.84-v8+
Architecture: arm64
Solution
Solution (see comment from Nate Eldredge):
I followed this german article to upgrade the kernel to 64bits. Nate Eldredge responded with a possible solution. Quoted Comment:
From that article (translated): "With the switch from the Raspberry Pi OS to 64-bit, we have both the CPU and the operating system on 64-bit, while most programs are still running in 32-bit". So indeed, only your kernel is 64 bits, not userland programs like php. You might be able to install a 64-bit php as multiarch, but AFAIK this is not officially supported for Raspbian, and is painful even if it does work. You'll be much happier in the long run if you start over and install a fully 64-bit distro. Ubuntu for instance works fine.
Answered By - xy8000 Answer Checked By - Cary Denson (WPSolving Admin)