APPWeb + PHP5 + SQLite3 port on the initi6410

Source: Internet
Author: User
Tags zts

Related support library migration

It mainly includes libiconv, zlib, and matrixssll.

Download the third-party Toolkit provided by Embedthis and use git to obtain the packages Package from GitHub. The command is as follows.

Gitclone http://github.com/embedthis/packages

If the download fails, you can download the zip package directly at https://github.com/embedthis/packagesand choose the volume package:


Among them, libiconv-1.11, zlib and matrixssl in the matrixssl1-8-8-open was transplanted using, php Directory in the PHP version is higher, and the default Target Platform for Linux and Windows platform, does not support cross compilation, many problems may occur during compilation. This porting is not used.

1. Compile libiconv

Libiconv library is required to compile xmlrpc support library, select the libiconv-1.11, note: the latest version of ionv, compilation may have many problems, here is not recommended.

First, set the path of environment variables such as CC and AR (assuming that the arm-linux-gcc tool is installed in the/usr/local/arm/4.2.2-eabi/directory). The specific settings are as follows.

Export CC =/usr/local/arm/4.2.2-eabi/usr/bin/arm-linux-gcc

Export AR =/usr/local/arm/4.2.2-eabi/usr/bin/arm-linux-ar

Export LD =/usr/local/arm/4.2.2-eabi/usr/bin/arm-linux-ld

Export RANLIB =/usr/local/arm/4.2.2-eabi/usr/bin/arm-linux-ranlib

Export STRIP =/usr/local/arm/4.2.2-eabi/usr/bin/arm-linux-strip

Export CC_FOR_BUILD = gcc

Configuration:

./Configure -- build = arm-linux -- host = i686-linux -- prefix =/usr/local/iconvarm

After the configuration is complete, compile and install:

Make

Make install

The -- prefix parameter specifies the location where the libconv library is installed and must be referenced during PHP compilation.

2. Compile libz. so

Zlib is a required support library for PHP, and the version used here is the zlib-1.2.6. Note: Set CC, AR, and other environment variables to arm-linux-xx.

./Configure -- prefix =/usr/local/zlib

After the configuration is successful, compile:

Make clean

Make

The -- prefix parameter specifies the location where the libz library is installed. When compiling PHP, add the -- with-zlib-dir =/usr/local/zlib compilation parameter.

3. Compile libxml2.so

The source package version is libxml2-2.7.4, libxml2 library is also required for PHP support library.

../Configure -- build = arm-linux -- host = i686-linux -- disable-ipv6 -- prefix =/usr/local/libxmlarm

After the configuration is successful, compile and install:

Make

Make install

 

Compile PHP

After the above supported libraries are compiled, PHP compilation is performed. Note: The *. so file format obtained by the above compilation must be in the following format:

Libz. so.1.2.6: ELF 32-bit LSB shared object, ARM, version 1 (SYSV), dynamically linked, not stripped

In addition, the compiled library file contains debugging information. You can use the arm-linux-strip tool to remove unnecessary debugging information to reduce the file size.

PHP version used for PHP-5.2.17 (PHP-5.3.8 problems, such as failure to run, the server automatically restart, it is recommended to use this version ).

The PHP configuration parameters are as follows:

. /Configure -- target = arm -- host = arm-linux -- disable-debug -- disable-rpath -- disable-cli -- enable-bcmath -- enable-calendar -- disable-maintainer-zts -- enable -embed = shared -- enable-ftp -- enable-inline-optimization -- enable-magic-quotes -- enable-safe-mode -- enable-sockets -- enable-wddx -- sysconfdir =/etc/ appweb -- with-pic -- with-exec-dir =/etc/appweb/exec -- with-regex = system -- with-pear -- with-xmlrpc -- with-zlib-dir =/ usr/local/zlib -- with-libxml-dir =/usr/local/libxmlarm -- with-iconv-dir =/usr/local/iconvarm/

Note: When the multi-threaded mode is enabled, that is, when the parameter -- enable-maintainer-zts is compiled, the following error message is returned:


The preceding error can be solved by modifying the configure file. The modification is as follows:

Convert {echo "configure: error: Your system seems to lack POSIXthreads." 1> & 2; exit 1 ;}
Replace:

{Echo "configure: error: Your system seems to lack POSIX threads." 1> & 2 ;}# exit 1 ;}

 

The following table compares the Running Performance of PHP scripts in multi-thread and single-thread modes (measured by the PHP probe.

Table 2 Comparison of PHP Performance

 

 

Performance Parameters

Single-thread model

ARM11 667 MHz

Multithreading Model

ARM11 667 MHz

IXwebhosting.com

4 x Xeon E5530 @ 2.40 GHz

Integer computing capability Detection
(1 + 1 Operations 3 million times)

7.439 s

15.547 s

0.535 s

Floating Point computing capability Detection
(The circumference rate is 3 million times)

42.599 s

Unable to measure

1.607 s

Data I/O capability Detection
(Read 10 k files 10 thousand times)

0.961

11.112 s

0.058 s

Through the comparison and analysis above, the system performance in single-thread mode is better than that in multi-thread mode. Therefore, in this transplant, PHP is configured in single-thread mode, and AppWeb also needs to disable the multi-thread mode.

After the configuration is complete, check the generated Makefile to ensure that environment variables such as CC and CPP point to the Cross-compilation chain, that is, arm-linux-xx, and whether the path of the relevant library file and header file is correct. The correct configuration information is shown in:


After the configuration is successful, the system prompts the following information:


Compile and install:

Make clean

Make

Make install

If the following error occurs during compilation, it indicates that the tool chain for compiling PHP is not arm-linux-gcc but gcc, therefore, you need to reset the CC, AR, and other environment variables to point to the arm-linux-xx cross tool chain.


Compiled successfully. The system prompts the following information:


Note: make test cannot be executed after compilation. Because the PHP compilation target is a gateway (ARM platform), an error will be reported during runtime. Run makeinstall directly for installation.

After the installation is complete, generate the libphp5.so dynamic library file in the libs/directory, and run the file command to view the file information, as shown below:


Before the strip tool is used to remove debugging information, the size of the compiled library file is 12.5 MB, and the size of the library file obtained by executing arm-linux-strip is only 3.8 MB.
  • 1
  • 2
  • 3
  • 4
  • Next Page

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.