php5在arm-linux下的交叉编译步骤
来源:互联网 发布:异次元的狙击手 知乎 编辑:程序博客网 时间:2024/06/05 09:17
折腾了一周多终于成功交叉编译了php-5.2.9,现在总结一下,希望能给像我一样的菜鸟提供点帮助。步骤如下:
1. 首先交叉编译zlib。
CC=arm-linux-gcc ./configure --sahred --prefix=/usr/local/arm/3.4.1/arm-linux
make&&make install
(一开始我把zlib装在独立的目录下,编译php时在用上--with-zlib选项还是报错,后来直接安装到我交叉编译器目录/usr/local/arm/3.4.1/arm-linux下就不报错了。)
2. 接着交叉编译libxml2。
CC=arm-linux-gcc ./configure --host=arm-linux --prefix=/usr/local/arm/3.4.1/arm-linux
make&&make install
(安装到/usr/local/arm/3.4.1/arm-linux下的原因同上)
3. 交叉编译php-5.2.9。
(1) CC=arm-linux-gcc ./configure --host=arm-linux --prefix=/usr/local/php-arm --disable-all --enable-pdo --with-sqlite --with-pdo-sqlite --with-zlib --without-iconv
(用--with-apxs2选项会报错,所以选择了编译成cgi模式)
(2) make&&make install
(make的时候出现:undefined reference to dlopen、undefined reference to dlclose,解决方法:在makefile中EXTRA_LIBS之后加上-ldl)
(3) 将PHP源码包中php-.ini-dist文件复制到/usr/local/php-arm/lib下并改名为php.ini。
(4) 用arm-linux-strip把bin目录下的php和php-cgi进行strip。
(5) 将php-arm文件件拷贝到arm板上的/usr/local目录下。
(6) 最后修改arm板上apache的配置文件httpd.conf。添加如下语句:
DirectoryIndex index.php
DirectoryIndex index.php3
DirectoryIndex index.phtml
ScriptAlias /php5/ "/usr/local/php-arm/bin/"
# 注意 "/usr/local/php-arm/bin/" 中最后一个"/"不可少
<Directory "/usr/local/php-arm/bin">
AllowOverride None
Options None
Order allow,deny
Allow from all
</Directory>
AddType application/x-httpd-php .php3
AddType application/x-httpd-php .php
AddType application/x-httpd-php .phtml
Action application/x-httpd-php "/php5/php-cgi"
大功告成!在arm上写一个phpinfo测试页面。在浏览器里输入:http://202.115.30.111:8080/test.php(我设置的监听端口为8080),可以看到php相关信息。
(一开始我把pdo、sqlite编译成动态模块,可是在phpinfo下始终看不到pdo、sqlite信息,查看错误日志说是无法加载动态库,动态加载不支持,不知道怎么改,索性将其编译成静态的,一切就ok了)
1. 首先交叉编译zlib。
CC=arm-linux-gcc ./configure --sahred --prefix=/usr/local/arm/3.4.1/arm-linux
make&&make install
(一开始我把zlib装在独立的目录下,编译php时在用上--with-zlib选项还是报错,后来直接安装到我交叉编译器目录/usr/local/arm/3.4.1/arm-linux下就不报错了。)
2. 接着交叉编译libxml2。
CC=arm-linux-gcc ./configure --host=arm-linux --prefix=/usr/local/arm/3.4.1/arm-linux
make&&make install
(安装到/usr/local/arm/3.4.1/arm-linux下的原因同上)
3. 交叉编译php-5.2.9。
(1) CC=arm-linux-gcc ./configure --host=arm-linux --prefix=/usr/local/php-arm --disable-all --enable-pdo --with-sqlite --with-pdo-sqlite --with-zlib --without-iconv
(用--with-apxs2选项会报错,所以选择了编译成cgi模式)
(2) make&&make install
(make的时候出现:undefined reference to dlopen、undefined reference to dlclose,解决方法:在makefile中EXTRA_LIBS之后加上-ldl)
(3) 将PHP源码包中php-.ini-dist文件复制到/usr/local/php-arm/lib下并改名为php.ini。
(4) 用arm-linux-strip把bin目录下的php和php-cgi进行strip。
(5) 将php-arm文件件拷贝到arm板上的/usr/local目录下。
(6) 最后修改arm板上apache的配置文件httpd.conf。添加如下语句:
DirectoryIndex index.php
DirectoryIndex index.php3
DirectoryIndex index.phtml
ScriptAlias /php5/ "/usr/local/php-arm/bin/"
# 注意 "/usr/local/php-arm/bin/" 中最后一个"/"不可少
<Directory "/usr/local/php-arm/bin">
AllowOverride None
Options None
Order allow,deny
Allow from all
</Directory>
AddType application/x-httpd-php .php3
AddType application/x-httpd-php .php
AddType application/x-httpd-php .phtml
Action application/x-httpd-php "/php5/php-cgi"
大功告成!在arm上写一个phpinfo测试页面。在浏览器里输入:http://202.115.30.111:8080/test.php(我设置的监听端口为8080),可以看到php相关信息。
(一开始我把pdo、sqlite编译成动态模块,可是在phpinfo下始终看不到pdo、sqlite信息,查看错误日志说是无法加载动态库,动态加载不支持,不知道怎么改,索性将其编译成静态的,一切就ok了)
- php5在arm-linux下的交叉编译步骤
- Linux下搭建ARM交叉编译环境的步骤
- Glib在arm-linux下的交叉编译
- linphone在ARM-Linux下的交叉编译
- ubuntu14.04 交叉编译php5 交叉编译工具arm-linux
- openssl 在arm下的 交叉编译
- openssl在arm下的交叉编译
- 在ubuntu下安装交叉编译器arm-linux-gcc步骤
- live555在arm linux下的交叉编译,并下载的Arm板播放H264文件
- live555在arm linux下的交叉编译,并下载的Arm板播放H264文件
- 在 Fedora 下建立 ARM-Linux 交叉编译环境
- 在 Fedora 下建立 ARM-Linux 交叉编译环境
- 在Ubuntu10.10下安装arm-linux交叉编译环境
- 在Fedora 下建立 ARM-Linux 交叉编译环境
- linux下编译arm-gcc的交叉编译总结
- linux下编译arm-gcc的交叉编译总结
- 在linux下使用crosstool制作自己的arm交叉编译环境
- 在linux下使用crosstool-0.43制作自己的arm交叉编译环境 (转)
- 网站分析实战——如何以数据驱动决策,提升网站价值(大数据时代的分析利器)
- 【struts2】赵雅智_Action名称的搜索顺序
- Java中读取字符文件类FileReader
- 如何在Java中进行图片剪裁
- HTTP代理区别
- php5在arm-linux下的交叉编译步骤
- [嵌入式中国 http://www.armchina.cn/ 转帖]既是老师又是师兄的临别箴言
- 鸟哥的私房菜——总结(一)
- ContentObserver的使用
- 收集的ORACLE电子书,新年共享啦!!(会持续更新)
- 多线程、线程池
- ubuntu+apache2+php5+mysql5.0的安装
- Hibernate+Spring+Struts2+ExtJS开发CRUD功能
- LA--3027--Corporative Network