移植 Nginx+PHP(FastCGI) 到 ARM Linux (二)
2017-09-13 23:50
1086 查看
环境
交叉编译环境:Ubuntu12.04 64位交叉编译器:arm-linux-gcc-4.9.x
ARM系统:Linux imx6dlsabresd 3.14.52-1.1.1_ga+gdb1bcba #5 SMP PREEMPT Wed Mar 15 12:15:01 CST 2017 armv7l GNU/Linux
PHP 交叉编译
1、 预先下载好文件a,php-5.6.31.tar.bz2
2、 解压文件
robinson@robinson-vm:~/Downloads tar -xjvf php-5.6.31.tar.bz2
4、 编写configure配置文件脚本simple_configure.sh,此文件存放于解压后的php-5.6.31文件夹下(最简易php编译)
#!/bin/sh ./configure \ --prefix=/home/php_arm \ --host=arm-linux-gnueabihf \ --disable-all
如果需要添加个别模块,可自行在configure参数添加。如添加json模块
#!/bin/sh ./configure \ --prefix=/home/php_arm \ --host=arm-linux-gnueabihf \ --disable-all \ --enable-json
5、运行脚本./simple_configure.sh
robinson@robinson-vm:~/Downloads/php-5.6.31$ su Password: root@robinson-vm:/home/robinson/Downloads/php-5.6.31# ./simple_configure.sh ***************** ***************** ***************** checking how to hardcode library paths into programs... immediate checking whether stripping libraries is possible... yes checking if libtool supports shared libraries... yes checking whether to build shared libraries... no checking whether to build static libraries... yes creating libtool appending configuration tag "CXX" to libtool Generating files configure: creating ./config.status creating main/internal_functions.c creating main/internal_functions_cli.c +--------------------------------------------------------------------+ | License: | | This software is subject to the PHP License, available in this | | distribution in the file LICENSE. By continuing this installation | | process, you are bound by the terms of this license agreement. | | If you do not agree with the terms of this license, you must abort | | the installation process at this point. | +--------------------------------------------------------------------+ Thank you for using PHP. config.status: creating php5.spec config.status: creating main/build-defs.h config.status: creating scripts/phpize config.status: creating scripts/man1/phpize.1 config.status: creating scripts/php-config config.status: creating scripts/man1/php-config.1 config.status: creating sapi/cli/php.1 config.status: creating sapi/cgi/php-cgi.1 config.status: creating main/php_config.h config.status: executing default commands 错误1:checking whether libxml build works... no 解决1: sudo apt-get install libxml2-dev
6、make
root@robinson-vm:/home/robinson/Downloads/php-5.6.31# make *********************** Zend/zend_virtual_cwd.lo Zend/zend_ast.lo Zend/zend_objects.lo Zend/zend_object_handlers.lo Zend/zend_objects_API.lo Zend/zend_default_classes.lo Zend/zend_execute.lo main/internal_functions_cli.lo sapi/cgi/cgi_main.lo sapi/cgi/fastcgi.lo -lcrypt -lcrypt -lm -lcrypt -lcrypt -o sapi/cgi/php-cgi Build complete. Don't forget to run 'make test'.
7、make install
root@robinson-vm:/home/robinson/Downloads/php-5.6.31# make install Installing PHP CLI binary: /home/php_arm/bin/ Installing PHP CLI man page: /home/php_arm/php/man/man1/ Installing PHP CGI binary: /home/php_arm/bin/ Installing PHP CGI man page: /home/php_arm/php/man/man1/ Installing build environment: /home/php_arm/lib/php/build/ Installing header files: /home/php_arm/include/php/ Installing helper programs: /home/php_arm/bin/ program: phpize program: php-config Installing man pages: /home/php_arm/php/man/man1/ page: phpize.1 page: php-config.1
8、打包交叉编译好的文件
robinson@robinson-vm:~/Downloads/php-5.6.31$ ls /home/ nginx_arm nginx_arm.tar.bz2 php_arm robinson robinson@robinson-vm:/home$ sudo tar -jcvf php_arm.tar.bz2 php_arm/ robinson@robinson-vm:/home$ ls nginx_arm nginx_arm.tar.bz2 php_arm php_arm.tar.bz2 robinson
9、将文件拷贝到ARM板子
root@imx6dlsabresd:/home# ls Test nginx_arm php_arm.tar.bz2 root root@imx6dlsabresd:/home# tar -xjvf php_arm.tar.bz2 root@imx6dlsabresd:/home# ls Test nginx_arm php_arm php_arm.tar.bz2 root
10、测试PHP
root@imx6dlsabresd:/home/php_arm/bin# ls php php-cgi php-config phpize test.php 新建的test.php内容为:<?php echo "Hellor word!\n"; ?> root@imx6dlsabresd:/home/php_arm/bin# ./php-cgi test.php X-Powered-By: PHP/5.6.31 Content-type: text/html; charset=UTF-8 Hello word! root@imx6dlsabresd:/home/php_arm/bin#
后记
友情提示:su命令会获取root权限但仍使用用户的环境变量。
sudo命令会获取root权限并使用root的环境变量。
相关文章推荐
- 移植 Nginx+PHP(FastCGI) 到 ARM Linux (三)
- 移植 Nginx+PHP(FastCGI) 到 ARM Linux (一)
- lighttpd+php(fastcgi) 移植到arm-linux
- linux下搭建nginx+php(FastCGI)+mysql运行环境
- 基于arm-linux-gcc的Apache和PHP移植
- 基于arm-linux-gcc的Apache和PHP移植
- php5.2.6移植到arm-linux摘要
- linux下nginx+php(fastcgi)web服务器搭建
- [Linux] Ubuntu_9.04_server安装nginx+php(fastcgi)+nginx虚拟主机配置格式
- libmxml (Mini-XML) arm-linux 移植笔记
- 移植libgsoap libssl libcrypto到arm(arm-hismall-linux)
- 交叉编译Python3.6.2,使用海思arm-hisiv200-linux-gcc,移植到arm开发板上
- ARM-Linux驱动移植--Watch Dog Timer(看门狗)驱动移植
- ARM-Linux 内核移植--基于FL2440开发板(修改为Linux单系统)
- Linux/Unix下nginx+php安装简明教程
- qte移植make install时 arm-linux-ranlib:command not found
- 汇总(之四):交叉编译工具链arm-none-linux-gnueabi-, Qt交叉编译安装和移植,Qt桌面版编译安装,QTcreator安装和配置
- 我的arm_linux移植笔记
- 通过ssh连接开发板——arm-linux下ssh的移植
- 在ARM-Linux平台上移植SQLite