PHP移植

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=/mnt/apps/php-arm --disable-all --enable-fastcgi --enable-session --enable-tokenizer --enable-pdo --with-sqlite --with-pdo-sqlite --with-zlib --with-pcre-regex  --without-iconv --enable-libxml --enable-spl --enable-simplexml --enable-json (用--with-apxs2选项会报错,所以选择了编译成cgi模式) (2) make&&make install (make的时候出现:undefined reference to dlopen、undefined reference to dlclose,解决方法:在makefile中EXTRA_LIBS之后加上-ldl) (3) 将PHP源码包中php-5.2.9.ini-dist文件复制到/mnt/apps/php-arm/lib下并改名为php.ini。 (4) 用arm-linux-strip把bin目录下的php和php-cgi进行strip。 (5) 将php-arm文件件拷贝到arm板上的/mnt/apps目录下。 (6) 最后修改arm板上apache的配置文件httpd.conf。添加如下语句: DirectoryIndex index.php DirectoryIndex index.php3 DirectoryIndex index.phtml

ScriptAlias /php5/ "/mnt/apps/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"

CFLAGS=”-I/home/test/include”

mathinline.h

有志者事竟成
原文地址:https://www.cnblogs.com/dancheblog/p/3508675.html