After several days of hard work, I finally built an apache+sqlite+php platform on the arm-linux platform.
There are a lot of information about apche and sqlite on the Internet, but there are very few about php for arm-linux. It took a lot of time to install php on the arm platform. So I will post the installation process here, hoping it will be helpful to everyone.
Sqlite for Arm Linux Installation
1. Download sqlite3.3.8: Please go to http://www.sqlite.org/download.html, unzip the downloaded code package, and the sqlite3.3.8 directory will be generated.
2. Modify the configure file and comment out the following statement
#if test "$cross_compiling" = "yes"; then
# { { echo "$as_me:$LINENO:: error: unable to find a compiler for building build tools" >&5#echo "$as_me: error: unable to find a compiler for building build tools" >&2;}
# { (exit 1); exit 1; }; }
#fi
. . .
#else
# test "$cross_compiling" = yes &&
# { { echo "$as_me:$LINENO:: error: cannot check for file existence when cross compiling" >&5
#echo "$as_me: error: cannot check for file existence when cross compiling" >&2;}
# { (exit 1); exit 1; }; }
. . .
#else
# test "$cross_compiling" = yes &&
# { { echo "$as_me:$LINENO:: error: cannot check for file existence when cross compiling" >&5
#echo "$as_me: error: cannot check for file existence when cross compiling" >&2;}
# { (exit 1); exit 1; }; }
3. Configuration
./configure –prefix=/data0/sqlite --disable-tcl --host=arm-linux
4. Modify the Makefile
Change BCC = arm-linux-gcc -g -O2 to BCC = gcc -g -O2
5. Modify the Makefile file and compile the sqlite3 program as a statically linked library
First you need to add libsqlite3.a compilation
Then sqlite3$(TEXE): $(TOP)/src/shell.c .libs/libsqlite3.la sqlite3.h
Change to lite3$(TEXE): $(TOP)/src/shell.c .libs/libsqlite3.a sqlite3.h
-o $@ $(TOP)/src/shell.c .libs/libsqlite3.la
Change to -o $@ $(TOP)/src/shell.c .libs/libsqlite3.a
6. Make
7. #arm-linux-strip sqlite3
8. Upload sqlite3 to the terminal
9. Sqlite3 program test
sqlite3 test
,if you see the following messages:
SQLite version 3.3.8
Enter ".help" for instructions
sqlite>
input some commands to do something,
sqlite> create table tbl(one varchar(10),two smallint);
sqlite> insert into tbl values('hello',10);
sqlite> insert into tbl values('goodbye',20);
sqlite> .quit
10. Test C program
argv[i] ? argv[i] : "NULL")
;
} printf ("n" ) ; return 0; }
int main(int argc, char **argv ){ sqlite3 *db ; char *zErrMsg = 0; int rc; if( argc != 3 ){ fprintf (stderr, "Usage : %s DATABASE SQL-STATEMENTn", argv[0]); exit(1); } rc = sqlite3_open(argv[1], &db); if( rc ){ fprintf(stderr, "Can't open database: %sn", sqlite3_errmsg(db)); sqlite3_close(db); exit(1); } rc = sqlite3_exec(db, argv[2], callback, 0, &zErrMsg); if( rc !=SQLITE_OK ){ fprintf(stderr, "SQL error: %sn", zErrMsg); sqlite3_free(zErrMsg); } sqlite3_close(db); return 0; }
#arm-linux-gcc test.c -L.libs -lsqlite3 –static
#arm-linux-strip a.out
Upload the a.out program to the terminal and execute
#a.out test "select * from tbl"
one = hello
two = 10
one = goodbye
two = 20
Apache Server for ARM Linux
1. Download apache_1.3.39.tar.gz from http://www.apache.org/ , unzip it into a directory, and then change to the apache_1.3.39 directory.
2. Use local gcc to compile this version and run:
./configure
After make is completed, no make install is needed
3. Then create a new directory for compiling the arm version, unzip apache_1.3.39.tar.gz in that directory, go to apache_1.3.39 in that directory, and run:
export CC="arm-linux-gcc"
./configure --prefix=/data0/apache/ --without-execstrip --enable-module=so
Then run the make command. The compilation will fail at apache_1.3.39/src/main/gen_test_char because the arm version of the program cannot run on the local machine. You need to overwrite the arm version with the previously compiled local version of apache_1.3.39/src/main/gen_test_char, and then switch to the arm version of apache_1.3.39 to continue make. Then compile another program apache_1.3.39/src/main/gen_uri_delims and the same problem will occur. Use the local version to overwrite it and continue make until the compilation is successful.
4. --prefix=/data0/apache / specifies the installation directory as /data0/apache/. Run make install. All compiled arm version apache programs are installed in the /data0/apache/ directory. Compress this directory, upload it to the terminal, and then modify the conf/httpd.conf configuration file.
5. Note that you need to modify conf/httpd.conf and add ServerName www.willfar-ertu.com:80 . Otherwise, a warning will be reported when starting the service: httpd: Could not reliably determine the server's fully qualified domain name, using 127.0.1.1 for ServerName
6. Execute the following command to determine whether Apache is installed successfully. http://IP:80 If the Apache description page is displayed, it means that the installation is successful. If a 403 error message appears, please confirm whether the Apache directory permission is 755, including the parent directory of Apache.
PHP for ARM Linux
1. Download php-4.4.8.tar.gz from http://www.php.net , unzip it, and then go to the php-4.4.8 directory.
2. export CC="arm-linux-gcc"
3. Modify the configure file and comment out the cross-compilation error handling, for example:
#if test "$cross_compiling" = yes; then
# { echo "configure: error 7: can not run test program while cross compiling" 1>&2; exit 1; }
#else
4 ./configure --prefix=/data0/php --with-apxs=/data0/apache/bin/apxs --enable-pdo=shared --with-sqlite=shared --with-pdo-sqlite=shared --with-zlib --host=arm-linux --enable-track-vars --with-xml
5. When executing ./configure, some errors will be reported. According to the error prompts, modify the configure file to comment out the error handling until it succeeds.
6. Modify the Makefile file and change
EXTRA_LIBS = -lcrypt -l -lcrypt -lz -lm -lcrypt –lcrypt
Replace with
at http://ip/index.php , it means PHP is installed successfully.
PHP Version 4.4.8
System
Linux localhost 2.4.18-rmk7-pxa1 #2 Thu Dec 27 12:28:52 CST 2007 armv4l
Build Date
Feb 3 2008 11:58:44
Configure Command
'./configure' '--prefix=/data0/php' '--with-apxs=/data0/apache/bin/apxs' '--enable-pdo=shared' '--with-sqlite=shared' '--with-pdo-sqlite=shared' '--with-zlib' '--host=arm-linux' '--enable-track-vars' '--with-xml'
Server API
Apache
Virtual Directory Support
disabled
Configuration File (php.ini) Path
/data0/php/lib
PHP API
20020918
PHP Extension
20020429
Zend Extension
20050606
Debug Build
no
Zend Memory Manager
enabled
Thread Safety
disabled
Registered PHP Streams
php, http, ftp, compress.zlib
Combining PHP with sqlite3
First download the php-sqlite3 compressed package from the php website
1. Unzip the compressed package to a directory.
2. Enter the directory and run /data0/php/bin/phpize
3../configure --with-php-config=/data0/php/bin/php-config --with-sqlite3=your sqlite3 installation directory
4.make
5.make install
6. Put the generated sqlite3.so in the php extension directory.
7. Load the sqlite3.so module in php.ini
Previous article:ARM bare metal article--serial UART experiment
Next article:ARM architecture and system structure
Recommended ReadingLatest update time:2024-11-16 12:48
- Popular Resources
- Popular amplifiers
Professor at Beihang University, dedicated to promoting microcontrollers and embedded systems for over 20 years.
- Innolux's intelligent steer-by-wire solution makes cars smarter and safer
- 8051 MCU - Parity Check
- How to efficiently balance the sensitivity of tactile sensing interfaces
- What should I do if the servo motor shakes? What causes the servo motor to shake quickly?
- 【Brushless Motor】Analysis of three-phase BLDC motor and sharing of two popular development boards
- Midea Industrial Technology's subsidiaries Clou Electronics and Hekang New Energy jointly appeared at the Munich Battery Energy Storage Exhibition and Solar Energy Exhibition
- Guoxin Sichen | Application of ferroelectric memory PB85RS2MC in power battery management, with a capacity of 2M
- Analysis of common faults of frequency converter
- In a head-on competition with Qualcomm, what kind of cockpit products has Intel come up with?
- Dalian Rongke's all-vanadium liquid flow battery energy storage equipment industrialization project has entered the sprint stage before production
- Allegro MicroSystems Introduces Advanced Magnetic and Inductive Position Sensing Solutions at Electronica 2024
- Car key in the left hand, liveness detection radar in the right hand, UWB is imperative for cars!
- After a decade of rapid development, domestic CIS has entered the market
- Aegis Dagger Battery + Thor EM-i Super Hybrid, Geely New Energy has thrown out two "king bombs"
- A brief discussion on functional safety - fault, error, and failure
- In the smart car 2.0 cycle, these core industry chains are facing major opportunities!
- The United States and Japan are developing new batteries. CATL faces challenges? How should China's new energy battery industry respond?
- Murata launches high-precision 6-axis inertial sensor for automobiles
- Ford patents pre-charge alarm to help save costs and respond to emergencies
- New real-time microcontroller system from Texas Instruments enables smarter processing in automotive and industrial applications
- 【2022 Digi-Key Innovation Design Competition】Latest unboxing post
- EEWORLD University Hall----Live Replay: Intel FPGA Deep Learning Acceleration Technology
- How to assign IMX6-CB200 GPIO
- [Precise delay function] Precise delay function in IAR (MSP430)
- After reading this article from the Research Institute, I feel that 6-lane Wi-Fi still has a long way to go.
- Warning for trouble~~~~ la la la~ hurry to the front of the post to find out
- mcgs Kunlun Tongtai Modbus RTU, Modbus TCP communication method Modicon Modbus communication configuration steps
- Proficient in hardware and familiar with software
- [Nucleo G071 Review] SYSTICK & Comparison of Two Commonly Used Low Power Modes
- TMS320C66x dual loop and multiple loop optimization summary