ARM 平台部署apache + php + phpredis

编译环境:ubuntu12.04

交叉编译器:4.4.3

资源:apr-1.4.5,apr-util-1.3.12,pcre-8.10,libxml2-2.7.4,zlib-1.2.8,httpd-2.4.12,php-5.6.11,phpredis-2.2.5

1)、本地编译apr,apr-util,pcre
然后进入http-2.4.12目录执行
./configure --prefix=/mnt/nandflash/local/apache2 --with-apr=/mnt/nandflash/local/apr --with-apr-util=/mnt/nandflash/local/apr-util --with-pcre=/mnt/nandflash/local/pcre ap_cv_void_ptr_lt_long=no
。。。
make

2)、交叉编译apr,apr-util,pcre
然后交叉编译http-2.4.12:
./configure CC=arm-linux-gcc --host=arm-linux --prefix=/mnt/nandflash/arm/apache2 --with-apr=/mnt/nandflash/arm/apr --with-apr-util=/mnt/nandflash/arm/apr-util --with-pcre=/mnt/nandflash/arm/pcre --with-mpm=prefork ap_cv_void_ptr_lt_long=no 
将之前本地编译的http-2.4.12/server 下的gen_char_test 拷到交叉编译的server目录下
make && make install

3)、交叉编译libxml2-2.7.4,zlib-1.2.8
交叉编译php: 
CC=arm-linux-gcc ./configure --host=arm-linux --prefix=/mnt/nandflash/arm/php --disable-cli --disable-fileinfo --disable-opcache --enable-shared --enable-pdo --with-libxml-dir=/mnt/nandflash/arm/libxml --with-zlib-dir=/mnt/nandflash/arm/zlib --without-iconv --with-sqlite --with-apxs2=/mnt/nandflash/arm/apache2/bin/apxs



将本目录下的php.ini-development 拷到 /mnt/nandflash/arm/php/lib/php.ini

4)、进入解压好的phpredis-2.2.5中执行/mnt/nandflash/arm/php/bin/phpize
./confugure CC=arm-linux-gcc --host=arm-linux --with-php-config=/mnt/nandflash/arm/php/bin/php-config
make && make install


添加deamon 用户 组
修改配置文件
httpd.conf 添加AddType application/x-httpd-php .php

修改php.ini 在 Extensions 处添加 extension=redis.so 

/mnt/nandflash/web_arm/apache2.4/bin/apachectl start
启动apache 后  正常工作
测试phpredis, 提示没有找到这个类!

于是,查看phpinfo();  果然没有看到redis的信息  ,php 没有加载 redis.so 
接着查看php加载了哪些模块  ./php-cgi -m   ,确定没有加载redis模块
手动加载试试,
建一个redis.ini 文件
加上 下面两行内容
extension_dir=/mnt/nandflash/web_arm/php/lib/php/extensions/no-debug-none-zts-20131226
extension=redis.so
extension_dir 具体要看redis.so 的目录

在php/bin下执行./php-cgi -z redis.ini
提示:“Extensions are not supported on this plaform”  。。。终于看到提示信息了

在php源码中查找 “Extensions are not supported on this plaform” 出现的文件 
在zend_extensions.c 中     
原来是 ZEND_EXTENSIONS_SUPPORT 没有定义
而 ZEND_EXTENSIONS_SUPPORT 由 HAVE_LIBDL 决定 
查看configuer 文件,找到定义HAVE_LIBDL  的位置 

真相大白。。

由于是交叉编译,编译平台与运行平台不一样,corss_complie 的值为yes   ,所以导致没有定义HAVE_LIBDL 

知道问题所在,解决就简单了   在检测dl库 处 把found 改为yes就可以了

当然得保证运行平台有dl库!!












  • 1
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值