I know many have longed for a webserver, php and mysql for their msses, and finally their longing has come to an end. In this tutorial I will show how to install and and configure lighttpd-1.4.11, php-5.1.4 and mysql-5.0.22
Requirements
This tutorial assumes you have OpenMSS and BusyBox installed. For the latter one, issue ipkg install busybox on the commandline.
Furthermore, you must add a new repository to your ipkg list:
- Code: Select all
cat >> /opt/etc/ipkg.conf
src bryan http://ipkg.openmss.org/bryan
{Press: ctrl+d}
Then, install a new version of libc6 if you have not done yet before:
- Code: Select all
ipkg install libc6
For editting config files, vi is commonly used. Open a file by vi /path/to/file. Enter editmode by entering i. When your done, press escape twice, and type :wq<enter>.
lighttpd
As Apache is much to overweight for our 32MB MSS, I decided to use lighttpd, which is a webserver with the capabilities of Apache, but a much smaller memory usage.
1. Install lighttpd
- Code: Select all
ipkg install lighttpd
2. Configure lighttpd: lighttpd defaults to running at port 8080, with /opt/bin/lighttpd/var/wwwroot as it's root directory, but you can change that by editting /opt/bin/lighttpd/lighttpd.conf.
For PHP support add or change the following lines in /opt/bin/lighttpd/lighttpd.conf:
- Code: Select all
static-file.exclude-extensions = ( ".php" )
index-file.names = ( "index.html", "index.php" )
server.modules = ("mod_fastcgi", )
fastcgi.server = (
".php" => ((
"bin-path" => "/opt/bin/php",
"socket" => "/opt/bin/lighttpd/php.socket",
"max-procs" => 2,
"bin-environment" => (
"PHP_FCGI_CHILDREN" => "4",
"PHP_FCGI_MAX_REQUESTS" => "32"
),
"bin-copy-environment" => ( "PATH", "SHELL", "USER"),
"broken-scriptfilename" => "enable"
))
)
PHP
PHP Hypertext Processor is a commonly used scripting languages for websites, and now also available for OpenMSS.
1. Install PHP
- Code: Select all
ipkg install libxml2
ipkg install php5
2. If you want to modify the default PHP settings, you may create /opt/etc/php.ini
3. If you are running Firmware 1.2.2, you might need a new version of libpthread.
- Code: Select all
ipkg install http://ipkg.openmss.org/testing/libpthread_0.9_mipsel.ipk
MySQL
MySQL is a commonly used database system, with bindings to PHP.
1. Install MySQL (note: this may take a while to download and install)
- Code: Select all
ipkg install mysql
2. If you want to modify the default MySQL settings, the config file is located at /opt/usr/local/mysql/etc/my.cnf
Testing
1. Create a phpinfo.php file:
- Code: Select all
cat > /opt/bin/lighttpd/var/wwwroot/phpinfo.php
<?php phpinfo(); ?>
{Press: ctrl+d}
2. Start lighttpd:
- Code: Select all
/opt/bin/lighttpd/bin/lighttpd
3. Surf to http://address-of-your-mss:8080/phpinfo.php
Any mistakes in either this tutorial or one of my packages? Feel free to comment!
