arm编译安装php启动,为arm 编译包含gd的php5

本文详细记录了在Linux环境下跨平台编译PHP及其依赖库GD的过程,包括下载和编译libvpx、freetype、libpng等库,并在编译PHP时遇到的GD库相关链接错误问题。最终成功将编译好的PHP程序部署到目标环境,并通过phpinfo()检查配置。文章强调了在配置选项中正确指定GD库的重要性。
摘要由CSDN通过智能技术生成

1) 下载gd的各种依赖包。 但是不要下载gd本身,因为这是包含在php里的。

探索的时候也下载了 libvpx freetype,可惜最后的编译没过,就没有用上

2)编译各种(编译前记得把各种环境变量设上,这里我就直接用以前写好的cross-env.sh)

-- libvpx

xz -d libvpx-v1.3.0.tar.xztar -xvf libvpx-v1.3.0.tarcd libvpx-v1.3.0./configure --prefix=/h1root/usr/libvpx --target=armv7-linux-gcc

make && make install

-- tiff(后来没用上)

./configure --prefix=/h1root/usr/tiff --host=arm-linux

-- libpng(花了非常多的时间调查,这两个环境变量不设的话,似乎永远找不到zlib)

export LDFLAGS="-L/h1root/usr/zlib128/lib"export CPPFLAGS="-I /h1root/usr/zlib128/include"./configure --prefix=/h1root/usr/libpng --host=arm-linux

-- freetype

./configure --prefix=/h1root/usr/freetype --host=arm-linux --without-png

-- gd的单独编译应该不需要。不要下载gd

3) 编译php

千万要注意, --with-gd后不要跟任何东西。这样,就会利用php自带的gd source编译。

如果不这么做,最后连接时会产生错误。

ext/gd/gd.o: In function `zif_imageloadfont':

gd.c:(.text.zif_imageloadfont+0x1d0): undefined reference to `overflow2'gd.c:(.text.zif_imageloadfont+0x1ec): undefined reference to `overflow2'ext/gd/gd.o: In function `zif_imagecreatefromstring':

gd.c:(.text.zif_imagecreatefromstring+0x1b8): undefined reference to `gdGetC'gd.c:(.text.zif_imagecreatefromstring+0x1bc): undefined reference to `gdGetC'gd.c:(.text.zif_imagecreatefromstring+0x1c0): undefined reference to `getmbi'gd.c:(.text.zif_imagecreatefromstring+0x1d0): undefined reference to `gdGetC'gd.c:(.text.zif_imagecreatefromstring+0x1d4): undefined reference to `skipheader'collect2: ld returned 1exit statusmake[1]: *** [sapi/cgi/php-cgi] Fehler 1

make[1]: Leaving directory `/home/user/freetz/source/target-mips_gcc-4.6.4_uClibc-0.9.32.1/php-5.4.16'

./configure --prefix=/h1root/usr/php --host=arm-linux --enable-libxml --with-mysql=mysqlnd --with-mysqli=mysqlnd --with-pdo-mysql=mysqlnd --with-zlib=/h1root/usr/zlib128 --without-iconv --with-libxml-dir=/h1root/usr/libxml2 --without-pear --without-sqlite3 --with-gd --without-pdo_sqlite --with-jpeg-dir=/h1root/usr/jpeg --with-png-dir=/h1root/usr/libpng

4) 把编译好的程序放到运行环境执行, php --version.

一般会告诉你缺 libpng.so , libjpeg.so , 把这些连接库也考过去就可以了。

5)写个phpinfo的php,在浏览器里执行之后,就会知道php.ini具体该放哪里。 php源程序里有示例php.ini,拿过去用就行。

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值