OpenWrt to build Uhttpd+php+sqlite environment

Source: Internet
Author: User
Tags install php sqlite



I've been busy playing for one months, writing memos.





First


Brush machine, brush machine as far as possible to find the latest version of the tutorial, I just started to spend a lot of useless time on this





Modify UHTTPD Settings


Add one of the following information to the/ETC/CONFIG/UHTTPD


 
config uhttpd web 
    list listen_http 0.0.0.0:88
    option home /mnt/overlay/www
    option index_page index.php
    list interpreter ".php=/usr/bin/php-cgi"


The code explanation is:



New add an HTTP listener, on port 88, home directory/mnt/overlay/www, the default page is index.php,cgi added directory is. php=/usr/bin/php-cgi



The last two lines are added after the PHP installation is successful



Restart Web server:/etc/init.d/uhttpd restart





Install PHP




Update Software Library
opkg update
Install to the default directory (usr), followed by the program you want to install
opkg install php5 php5-cgi php5-mod-ctype php5-mod-hash php5-mod-pdo php5-mod-pdo-sqlite php5-mod-session php5-mod-sqlite 





If you need to configure a custom directory


Edit /etc/opkg.conf and add the following line:
dest udisk / mnt / sda1

Then execute the command
opkg update

opkg install -d udisk php5 php5-cgi php5-mod-ctype php5-mod-hash php5-mod-pdo php5-mod-pdo-sqlite php5-mod-session php5-mod-sqlite php5-mod-sqlite3 php5-mod- tokenizer php5-mod-xml

And then configure the soft connection
Establish a soft link, otherwise you will not find the corresponding library and configuration file:
cd / etc
ln -s /mnt/sda1/etc/php.ini php.ini
ln -s / mnt / sda1 / etc / php5 php5
cd / usr / lib
ln -s /mnt/sda1/usr/lib/libpcre.so.0.0.1 libpcre.so.0
ln -s /mnt/sda1/usr/lib/libpcreposix.so.0.0.0 libpcreposix.so.0
ln -s /mnt/sda1/usr/lib/libsqlite.so.0.8.6 libsqlite.so.0
ln -s /mnt/sda1/usr/lib/libsqlite3.so.0.8.6 libsqlite3.so.0
ln -s /mnt/sda1/usr/lib/libxml2.so.2.7.8 libxml2.so.2
ln -s /mnt/sda1/usr/lib/libz.so.1.2.3 libz.so
ln -s / mnt / sda1 / usr / lib / php php
cd / usr / bin
ln -s / mnt / sda1 / usr / bin / php-cgi php-cgi 




Configure PHP.ini


Modify the/etc/php.ini.
Remove the previous comment from the following line:
Extension=ctype.so
Extension=hash.so
Extension=pdo.so
Extension=pdo_sqlite.so
Extension=sqlite.so
Extension=session.so
Extension=tokenizer.so
Extension=xml.so
Extension=xmlreader.so
Extension=xmlwriter.so
To modify a row:
Short_open_tag = On
;d oc_root = "/www"//This is going to be annotated.
Date.timezone = Asia/shanghai//time zone setting may be problematic, Asia may not be able to






And then restart the Web server, run the viewing effect.


other


1. Mount the USB stick:



1) fdisk-l View the inserted USB drive, as follows


 
/dev/sda1   *           1           6       48163+  83  Linux
/dev/sda2               7         515     4088542+  83  Linux
/dev/sda3             516         776     2096482+  82  Linux swap / Solaris
/dev/sda4             777        2610    14731605    5  Extended
/dev/sda5             777        2610    14731573+  83  Linux


2) Create a new folder where you want to mount it, such as/mnt/sda1



3) Mount:


Mount/dev/sda1/mnt/sda1





OpenWrt to build Uhttpd+php+sqlite environment


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.