I am using PHP 5.4.2. You can download it from php site.
Download libxml
I am using libxml2-2.8. TOOLCHAIN_DIR is the directory pointing to your toolchain library, in my case, it's /opt/toolchain/
./configure --host=arm-linux-gnu --target=arm-linux CC=arm-none-linux-gnueabi-gcc
AR=arm-none-linux-gnueabi-ar LD=arm-none-linux-gnueabi-ld RANLIB=arm-none-linux-gnueabi-ranlib --prefix=[TOOLCHAIN_DIR]
Then issue
make install
Configure mysql config file
When compiling with MySQL support, I kept encountered following error:
mysqlnd/mysqlnd_portability.h:40:36: error: ./php_mysqlnd_config.h: No such file or directory
I got help from this site. Following is what you need to do to fix the missing file problem:
- Goto your php source folder, and navigate to ext/mysqlnd
- Then issue
mv config9.m4 config.m4
sed -ie "s{ext/mysqlnd/php_mysqlnd_config.h{config.h{" mysqlnd_portability.h
phpize
phpize
Please note that I need to specify explicit location to libxml directory in order to compile successfully, please change the path to the location of your libxml library.
export CC=arm-none-linux-gnueabi-gcc
./configure --host=arm-linux --without-pear --enable-libxml --with-libxml-dir=/opt/toolchain/arm-2009q3/arm-none-linux-gnueabi/libc --enable-simplexml --enable-mbregex --enable-sockets --enable-soap --enable-pdo --with-pdo-sqlite --with-sqlite3 --with-openssl --enable-calendar --enable-mysqlnd --with-mysql=mysqlnd --with-pdo-mysql=mysqlnd --with-mysqli=mysqlnd --disable-all
make -j 12