Porting apache + sqlite3 + php5 Based on loongson1b Development Board (mips architecture)

Source: Internet
Author: User
Tags sapi
Environment compilation platform: Ubuntu12.04 cross tool chain: gcc-3.4.6one plug sqlitedecompress sqlite-3.6.20.tar.gz to tool Directory: tarzxfSqlite-3.6.20.tar.gz-Chomexxxtools into sqlite-3.6.20 Directory: cdsqlite-3.6.201):. configure -- how.ipsel-linux (specify

Environment compilation platform: Ubuntu12.04 cross tool chain: gcc-3.4.6, transplantation Sqlite extract Sqlite-3.6.20.tar.gz to the tool Directory: tarzxfSqlite-3.6.20.tar.gz-C/home/xxx/tools into the sqlite-3.6.20 Directory: cdsqlite-3.6.20 1 ):. /configure -- host = mipsel-linux (specify

Environment

Compilation platform: Ubuntu12.04

Cross tool chain: gcc-3.4.6

I. Porting Sqlite

Decompress sqlite-3.6.20.tar.gz to the tool Directory: tar zxf Sqlite-3.6.20.tar.gz-C/home/xxx/tools

Go to the sqlite-3.6.20 Directory: cd sqlite-3.6.20

1):./configure -- host = mipsel-linux (specify the cross-compilation tool chain) -- prefix =/opt/mispel-linux-sqlite

2) make

3) make install

The following error occurs when you execute make:

Libtool: link: mipsel-linux-gcc-shared. libs/tclsqlite. o-Wl,-rpath-Wl,/opt/sqlite-3.6.20-embedded /. libs-Wl,-rpath-Wl,/opt/mipsel-linux-sqlite/lib. /. libs/libsqlite3.so-L/opt/tcl8.5.15/unix-ltclstub8.5-lpthread-Wl,-soname-Wl, libtclsqlite3.so-o. libs/libtclsqlite3.so/opt/gcc-4.3-ls232-softfloat/lib/gcc/mipsel-linux/4.3.0 /.. /.. /.. /.. /mipsel-linux/bin/ld: skipping incompatible/opt/gcc-4.3-ls232-softfloat/lib/gcc/mipsel-linux/4.3.0 /.. /.. /.. /.. /mipsel-linux/lib/libtclstub8.5.a when searching for-ltclstub8.5/opt/gcc-4.3-ls232-softfloat/lib/gcc/mipsel-linux/4.3.0 /.. /.. /.. /.. /mipsel-linux/bin/ld: cannot find-ltclstub8.5collect2: ld returned 1 exit statusmake: *** [libtclsqlite3.la] Error 1

Note: skipping incompatible is generally referenced by libraries of different processor architectures that do not belong to their own processor architectures,

The above situation is that the mipsel architecture references the x86 architecture library libtclstub8.5.

Therefore, the above problem can be solved only by cross-compiling tclsh with source code.

Solution: Decompress tcl8.5.15-src.tar.gz and enter the source code folder tcl8.5.15.

Run:

1)./configure -- host = mipsel-linux -- prefix =/opt/mipsel-linux-tclsh

2) make

3) make install

However, in./configure -- host = mipsel-linux -- prefix =/opt/mipsel-linux-tclsh

The following error occurs:

Fixstrtodd. o: In function 'fixstrtow': fixstrtodd. c :(. text + 0x0): multiple definition of 'fixstrtow' strtodd. o: strtodd. c :(. text + 0x0): first defined herecollect2:

Ld returned 1 exit statusmake: *** [libtcl8.5.so] Error 1

Execute the following statement:

[Root @ CaM/opt/tcl-embedded/unix 11: 45] # export ac_cv_func_strtodd = yes

[Root @ CaM/opt/tcl-embedded/unix 11: 46] # export tcl_cv_strtod_buggy = 1

You can solve the problem.

After compilation and installation are complete, the bin, include, and lib directories are generated under the directory of mipsel-linux-sqlite respectively.

Copy bin/sqlite3 and lib/libsqlite3.so. 0.8.6 to the/bin directory and/lib directory respectively,

Rename libsqlite3.so. 0.8.6 to libsqlite3.so. 0.

2. Port apache

$ Su (switch to root user)

1. Local Compilation

$ Cd/usr/local/apache-pc/apache_1.3.39

$./Configure

Error message:

Tracing ing for Apache, Version 1.3.39
+ Warning: Your 'echo 'command is slightly broken.
+ It interprets escape sequences per default. We already
+ Tried 'echo-e' but had no real success. If errors occur
+ Please set the SEO variable in 'configure 'manually
+ The required 'echo 'options, I. e. those which force your
+ 'Echo 'to not interpret escape sequences per default.
+ Using installation path layout: Apache (config. layout)
Creating Makefile
Creating Configuration. apaci in src
Syntax error-The configuration file is used only
Define the list of sorted ded modules or to set Makefile in src
Options or Configure rules, and I don't see that at all:
'$ (SRCDIR)/apaci'
Default
Default
No
No
No
Yes
No
Default
No
Default
Default

Solution:

This is because some shell script files use the wrong interpreter. You can solve this problem by using the following command.

# Rm-f/bin/sh
# Ln-s/bin/bash/bin/sh

$ Make

Error message:

Solution:

Change the conflicting functions in the prompt c file to another alias. For example, if getline is changed to get_line, a total of three c files need to be changed.

After executing make, the local compilation is completed, and the compilation tool we need is generated.

2. Cross-Compilation

(Note the cross-tool chain environment)

$ Cd/usr/local/apache-mipsel/apache_1.3.39

$ CC = mipsel-linux-gcc./configure -- prefix =/usr/local/apache-php/apache -- enable-module = so

Next, modify the settings as follows:
Cp/usr/local/apache-pc/apache-1.3.39/src/main/gen_test_char/usr/local/apache-pc/apache-1.3.39/src/main/gen_uri_delims/usr/ local/apache-mipsel/apache-1.3.39/src/main/

$ Make

Error message:

Solution:

$ Cp/usr/local/apache-pc/apache_1.3.39/src/main/gen_test_char/usr/local/apache-pc/apache_1.3.39/src/main/gen_uri_delims/usr/local/apache -mipsel/apache_1.3.39/src/main/

$ Make install

, The installation is successful.

Check whether the file is a cross-compiled file

$ File/usr/local/apache-php/apache/bin/httpd

3. Porting PHP

1. Locally compile php

$ Cd/usr/local/apache-pc/php-5.2.0

$./Configure

Error message:

Solution:

Sudo apt-get install flex

Error 2:

Solution:

Sudo apt-get install libxml2-dev

$ Make

2. Cross-Compilation

Install zlib-1.2.3

$ Cd/usr/local/apache-mipsel/zlib-1.2.3

$ CC = mipsel-linux-gcc./configure -- prefix =/usr/local/apache-php/zlib

$ Make

$ Make install

$ Cd/usr/local/apache-mipsel/php-5.2.0

$ CC = mipsel-linux-gcc./configure -- host = mipsel-linux

-- Prefix =/usr/local/apache-php/php -- with-apxs =/usr/local/apache-php/apache/bin/apxs -- enable-pdo = shared -- -sqlite = shared -- with-pdo-sqlite = shared -- with-zlib-dir =/usr/local/apache-php/zlib -- without-iconv

Error 1:

Solution:

Open the script/usr/local/apache-mipsel/php-5.2.0/configure plugin to search for "$ APXS-q

CFLAGS>/dev/null 2> & 1 "to comment out the following code.

Error 2:

Solution:

Install libxml2-2.6.11

$ Libxml2-2.6.11 cd

$ CC = mipsel-linux-gcc./configure -- host = mipsel-linux -- prefix =/usr/local/apache-php/zlib

$ Make

$ Make install

./After configure

Modify php Makefile to add LDFLAGS + =-ldl at the beginning.

Modify main/php. h and add # define HAVE_LIBDL 1 at the beginning. This macro is used to force dlopen during cross-compilation.

Then add the # include This is the dlopen header.

.

# If defined (HAVE_LIBDL) | HAVE_MACH_O_DYLD_H

# Include

# Include

# Include

Finally, modify sapi/apache/php_apache_http.h.

# Include "httpd. h"

# Include "http_config.h"

# Include "ap_compat.h"

# Include "compat. h"

# Include "http_core.h"

# Include "http_main.h"

# Include "http_protocol.h"

# Include "http_request.h"

# Include "http_log.h"

# Include "util_script.h"

Change it to the path # include "/usr/local/apache-php/apache/include/httpd. h" (directory of these header files)

# Make !!)

Error 1:

Solution:

Modify 23 lines of errors in mod_php5.c. Add the/usr/local/apache-arm11/apache/include path

Error 2:

Solution:

$ Cp/opt/gcc-3.4.6-2f/lib/libxml2.so/us r/lib/i386-linux-gnu/

Error 3 ::

Solution:

I don't know what went wrong for the moment. I can only comment out the code.

$ Make install

Error 1:

Solution:

$ Mv/usr/local/apache-php/apche/bin/httpd/usr/local/apache-php/apache/bin/httpd_backup

$ Cp/usr/local/apache-pc/apache/bin/http/usr/local/apache-php/apache/bin/httpd

Error 2:

Solution:

$ Mv/usr/local/apache-mipsel/php-5.2.0/sapi/cli/php/usr/local/apache-mipsel/php-5.2.0/sapi/cli/php_backup

$ Cp/usr/local/apache-pc/php-5.2.0/sapi/cli/php/usr/local/apache-mipsel/php-5.2.0/sapi/cli/

It should be successful without an accident. You can go to/usr/local/apache-php/to check whether a directory exists.

Restore the php and httpd of the original mips version back:

Cp/usr/local/apache-mips/php-5.2.0/scpi/cli/php_backup/usr/local/apache-php/bin/

Cp/usr/local/apache-mips/apache/bin/httpd_backup/usr/local/apache-php/apache/bin/httpd

4. Configure httpd. conf and php. ini

L modify httpd. conf

$ Vim/usr/local/apache-php/apache/conf/httpd. conf Add the red part

#

# DirectoryIndex: Name of the file or files to use as a pre-written HTML

# Directory index. Separate multiple entries with spaces.

#

DirectoryIndex index.html

DirectoryIndex index. php

DirectoryIndex index. php3

DirectoryIndex index. phtml

#

# AccessFileName: The name of the file to look for in each directory

# For access control information.

#

AccessFileName. htaccess

...

# Events in the realname directory are treated as applications and

# Run by the server when requested rather than as your ents sent to the client.

# The same rules about trailing "/" apply to ScriptAlias directives as

# Alias.

#

ScriptAlias/cgi-bin/"/usr/local/apache-php/apache/cgi-bin /"

ScriptAlias/php5/"/usr/local/apache-php/bin /"

#

# "/Usr/local/apache-php/apache/cgi-bin" shocould be changed to whatever your ScriptAliased

# CGI directory exists, if you have that configured.

...

#

# AddType allows you to tweak mime. types without actually editing it, or

# Make certain files to be certain types.

#

AddType application/x-tar. tgz

AddType application/x-httpd-php. php3

AddType application/x-httpd-php. php

AddType application/x-httpd-php. phtml

#

# AddEncoding allows you to have certain browsers uncompress

# Information on the fly. Note: Not all browsers support this.

# Despite the name similarity, the following Add * directives have nothing

L modify php. ini

$ Cp/usr/local/apache-mips/php-5.2.0/php. ini-dist/usr/local/apache-php/lib/

$ Mv/usr/local/apache-php/lib/php. ini-dist/usr/local/apache-php/lib/php.int

$ Vim/usr/local/apache-php/lib/php.int

; To possible security problems, if the code is not very well thought.

Register_globals = On

; Whether or not to register the old-style input arrays, HTTP_GET_VARS

; And friends. If you're not using them, it's recommended to turn them off,

5. porting to loongson1B

Ps is hard to burn into the board after

1. Package apache and php

# Tar cjf apache-php.tar.bz2 apache-php

2. Share with the Development Board through nfs

3. Create a Development Board/usr/local/

4. decompress the package to/usr/local/: consistent with the host machine.

5. Go to/usr/local/apache-php/apache/bin.

#./Apachectl start

Note that because Aapche does not support root users, make sure that there are nobody and nogroup groups in the Linux File System.

Add two users in/etc

Vi/etc/passwd:

Root: 0: 0: root:/bin/bash

Nobody: 65534: 65533: nobody: // bin/bash

Vi/etc/group:

Body: 65533:

Nogroup: 65534: nobody

Root: 0:

Users: 100:

Normal startup will pop up

If there are other problems, goole and Du Niang are common problems.

6. Open your browser and enter http: // ip: 8080 to see the apache test screen.


7. Add the program name to run the program: http: // ip: 8080/test. php.


So far, the lasp environment has been set up...

Related Article

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.