I have a Debian server (64 bits) and I want to connect it to a AS400\'s database through PHP. I have installed the IBM i Access for Linux and unixodbc. I have followed this tuto
This is a duplicate of #21286589. Just because you do not have a NULL
value doesn't mean you won't run in to problems when using a mis-matched ABI.
The problem here is that the old driver only sets 32-bits of the 64-bit indicator value and PHP reads the whole 64-bits. Here PHP sees the value 140707423584261, which is 0x7FF900000005
in hex. You can see the last 4 bytes are 0x00000005
which is 5 and should be the length of the actual data returned. The rest of it is garbage because the driver did not change those bytes.
As I mentioned in my answer for Linux odbc Fatal error: Allowed memory size, you will need to get the new ODBC driver from the IBM i Access Client Solutions Linux Application Package. This driver follows the full 64-bit ABI that unixODBC has used since 2.2.14. The new driver package also contains Debian .deb packages, so pretty much all the steps in the blog you referenced are no longer needed.