Building 32-bit PHP on 64-bit Fedora #################################### :date: 2023-07-14 05:17:00 +0300 :category: Linux :tags: php, cross-compilation This is a short howto for people who already know how to compile PHP. TL;DR: .. code-block:: sh CFLAGS='-m32' PKG_CONFIG_PATH=/usr/lib/pkgconfig ./configure --host=i886 --prefix=$HOME/Software/php32 --exec-prefix=$HOME/Software/php32 --with-gmp --enable-mbstring make && make install .. TEASER_END .. note:: See https://www.php.net/manual/en/install.unix.php first 64 bit GCC is good enough for the task, it only needs a bit of help. * ``CFLAGS='-m32'``. We need to tell the compiler that we're building a 32-bit app * ``PKG_CONFIG_PATH=/usr/lib/pkgconfig`` ... and using 32-bit libraries * ``./configure``. configure * ``--host=i886``. Any 32 bit host will do here * ``--prefix=$HOME/Software/php32``. Please so not make install into the real system paths! I use ``Software`` directory in my home to host anything custom built. * ``--exec-prefix=$HOME/Software/php32``. Same but for executables. * ``--with-gmp --enable-mbstring``. Configuring PHP as you like. See ``./configure --help`` for the list of params.