Building 32-bit PHP on 64-bit Fedora

This is a short howto for people who already know how to compile PHP.

TL;DR:

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

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.

Comments

Comments powered by Disqus