this how-to can be found on my website also: http://wpte.kicks-ass.net/forum/view...p?thread_id=14
Change-log
IntroductionCode:11-07-09 Added clean-up for lighttpd so it always start after a reboot. 11-07-09 Activated PEAR in php.ini 31-07-09 Fixed mysql starting under non-root user 21-09-09 Fixed possible insecurity for the www folder 21-09-09 Added fix for TraceWatch web counter ip2country database update 20-11-09 Added update for possible lighttpd version 1.4.24-1 problems 12-03-10 Updated a lot of messy unclear stuff 12-03-10 Updated eaccelerator howto because of a new stable version 12-03-10 Added ipkg eaccelerator howto for the ones that don't like building after a php update 12-03-10 Include the ipkg update and upgrade parts so users won't download old software 10-09-10 Massive cleanup and bug fixing because of ipkg package fixes: MySQL starting, php-fcgi, eaccelerator
First of all, you might wonder what all these packages are...
lighttpd: quite a famous web-server used by a few well known sites like youtube (yes youtube), mininova and thepiratebay! (see the whole list: http://redmine.lighttpd.net/wiki/lig...eredByLighttpd)
php: probably the most used web-based scripting language
MySQL: Free database software, also widely used in combination with php and CMS packages.
Eaccelerator: a free open-source PHP accelerator, optimizer, and dynamic content cache.
So there are some how-to's out there already about these packages, but they are not really that complete, or contain some old unfixed things.
What do you need?
1. A valid wengi-like ipkg installation
2. Build enviroment if you want to build eaccelerator (no worries, this will be explained newbie proof)
3. A few ipkg packages
4. Eaccelerator source code if you want to build eaccelerator
5. knowledge of basic linux stuff
6. about 300mb free optware space
7. enough swap space (About 15mb swap free)
Installation: Lighttpd
Well, lets start of easy by typing:
this will install the basic lighttpd package.ipkg update
ipkg upgrade
ipkg install lighttpd
When done enter:
now edit the following lines:vi /opt/etc/lighttpd/lighttpd.conf
(note: uncomment means remove the # in the beginning of the line)
This is for fixing the excluded e-poll:Code:line 40: change server.document-root = "/tmp/harddisk/www" (presuming you have the same mount point as in wengi's)
line 51: change
# server.event-handler = "freebsd-kqueue" # needed on OS X
into
server.event-handler = "poll" # needed on OS Xand save it!Code:line 139: change server.port = 8081 into: server.port = 80 (changing the webinterface port will be explained later)
now create the folder where your web pages will be saved (remember this)
By installing php-fcgi, the fast-cgi server will be enabled automatically, so there is no need of manually uncommenting the settings anymore.mkdir /tmp/harddisk/www
chmod 744 /tmp/harddisk/www
Because we want to host our web pages on the standard port of 80, we need to change the port of the web interface, since this is also hosted on port 80.
When someone thinks he can change it by doing portforwarding or virtual server... yeah, you can but you most likely get problems with cookies (and that isn't nice).
changing the port:
after a reboot you will need to access the web interface by this url:Code:nvram set http_lanport=8080 nvram commit
http://your-asus-router-ip:8080
Installation: php with some extensions
To be sure you are as covered as you can on this router, you can just add all the php packages available:
activate pear:ipkg install php php-curl php-dev php-fcgi php-gd php-imap php-ldap php-mbstring php-mysql php-pear php-xmlrpc
vi /opt/etc/php.iniSave the fileCode:Line 426: change the lines into this: ; UNIX: "/path1:/path2" include_path = ".:/opt/lib/php/extentions:/opt/share/pear"
as you will notice it will also install mysql, since we don't have to do anything for php yet lets move on to mysql!
Installation: MySQL
now we have mysql installed and started we have to set a password.
use this command:
note: leave the '' in the command, otherwise mysql won't understand!/opt/bin/mysqladmin -u root password 'secretpassword'
edit the my.cfg again to add the password for automatic login when you're in shell.
vi /opt/etc/my.cnfsave it!Code:line 20: uncomment and type your password password = yourpassword ofcourse change "yourpassword" into something you want to use as password! end result: [client] password = secret port = 3306 socket = /tmp/mysql.sock
now type:
and you will enter the mysql console, which is important to control your mysql server!mysql
a few handy commands:
for more commands please read the mysql manual.Code:Create a database = create database mydatabase; Remove a database = drop database mydatabase; select a database to use = use mydatabase; import sql queries = source /some/sql/file.sql; exit the prompt = exit;
Installation: Eaccelerator
In this how-to you can choose which eaccelerator you want.
The ipkg version is for people who don't want to worry about manually updating the php extension.
for now the build-your-own eaccelerator is more up to date.
(just pick the installation you prefer)
Installation: IPKG Eaccelerator
The worry-less installation
follow the final steps in "FINAL STEPS"ipkg install eaccelerator
Installation: OWN-BUILD Eaccelerator
for the die-hards (still it's simple to follow)
Don't forget to update eaccelerator when php receives an update
first of all we need the build environment, which takes a while to download:
you'll probably receive an error like:ipkg install wget optware-devel buildroot
don't worry, wget-ssl is reported as not working here, and wget is working just as wellCode:Collected errors: ERROR: The following packages conflict with wget-ssl: wget
while you are downloading everything, lets get the sources:
http://bart.eaccelerator.net/source/...-0.9.6.tar.bz2
(at this moment this is the latest version, you may download a newer version if available)
Just save the file to your pc, unpack it somewhere and place it on your router via samba share or ftp. Lets say you place the folder into /tmp/harddisk/eaccelerator-0.9.6
after the ipkg package installation is done, you can continue:
Before we start building, we need to install some libraries required by eaccelerator:
now lets get to the real building stuff:ipkg install re2c grep
please execute these command 1 at a time, to make sure everything goes well!cd /tmp/harddisk/eaccelerator-0.9.6
export PHP_PREFIX="/opt"
$PHP_PREFIX/bin/phpize
./configure --prefix=/opt --enable-eaccelerator=shared --with-eaccelerator-disassembler --with-eaccelerator-userid
make
make install
you shouldn't get any errors... (don't pay too mutch attention to the configure command, unless it tells you there is an error in the end)
note that make test is not possible and not required.
after you executed make install, the files are in place, ready to be used.
Now we only need to create a php configuration file.
and copy paste this into the filevi /opt/etc/php.d/eaccelerator.ini
save the file and execute the final commands to create the cache dir:Code:;;EACCELERATOR ;;the settings for eaccelerator extension=eaccelerator.so eaccelerator.shm_size="16" eaccelerator.cache_dir="/opt/tmp/eaccelerator" eaccelerator.enable="1" eaccelerator.optimizer="1" eaccelerator.check_mtime="1" eaccelerator.debug="0" eaccelerator.filter="" eaccelerator.shm_max="0" eaccelerator.shm_ttl="0" eaccelerator.shm_prune_period="0" eaccelerator.shm_only="0" eaccelerator.compress="1" eaccelerator.compress_level="3"
mkdir -p /opt/tmp/eaccelerator
chmod 777 /opt/tmp/eaccelerator
FINAL STEPS
lets create a file to test everything after the reboot:
and enter the code:vi /tmp/harddisk/www/index.php
save it,Code:<?php phpinfo(); ?>
and done you are, just a final reboot to restart everything properly:chmod 766 /tmp/harddisk/www/index.php
after the reboot you can visit http://your-asus-router/reboot
and you should get a page with information about the php installation... something you shouldn't get is a http 500 error.
if you get this error here, please look over the how-to again, because you might have missed something.
It is however possible that not all web packages work in this set-up, which is unfortunate, but there is no other option than find an alternative web package.