PDA

Bekijk de volledige versie : thttpd problem



Madar
06-06-2005, 05:56
I have the thttpd server up and running (Thanks Macsat for the excellent tutorial) and all is good with one exception; I can access pages in the first level of the www directory but I can't reach anything in subfolders. The pages and subfolders all have read permissions set across the board but I just can't access them through a browser. At first I was getting a message about the pages being executables and not allowed by the server (smart enough) so I took away all x permissions from everything so it's all just read only. Now I can't reach them at all... Any ideas?

Madar

hto
06-06-2005, 08:54
Directories needs to have the x permission set.

Havard

Madar
09-06-2005, 04:19
Doh!!!

Thanks Harvard :)

pastor
25-06-2005, 13:16
I'm running thttpd with php on my Wl500g as described in macsats tutorial. The problem is that I can't get the file upload working. Tested some upload-scripts from hotscripts.com, but not a single one worked.

With Firefox I get a "The Document contains no data" message and IE just presents an error-page.
I didn't change the orginal thttpd and php settings, but these settings should work.
The files I tried to upload are not big (50-500kb), so there shouldnt be a problem with the memory. And there shouldnt be a problem with the file permissions, because i made everything read/write-able for everyone and changed the thttpd user to admin.

Does anyone have a clue how to get it working?

wireless
25-06-2005, 19:21
I had the same problem. You'll probably succeed in uploading a tiny file (try a text file of just a few bytes). The problem apparently is that thttpd only accepts a tiny amount of post data :(

This limitation is never mentioned explicitly, but on google (newsgroups+www) I found some other users having exactly the same problem...

Of course: if there's anybody with a solution: let me know!

Frenck
02-08-2005, 09:32
After upgrading the php-thttpd package to php-thttpd_2.25b-5.0.4-1_mipsel.ipk with ipkg update / ipkg upgrade, the httpd server won't start anymore.

I've already tried a clean install of the php-thttpd package, but the error still exists.

If I look @ dmesg I find the following errors:

thttpd: Forwarding exception at [<800a90d4>] (801b15bc)
thttpd: Forwarding exception at [<800a90dc>] (801b15c8)
thttpd: Forwarding exception at [<800a90d4>] (801b15bc)
thttpd: Forwarding exception at [<800a90dc>] (801b15c8)


Any idea's?

mmX
02-08-2005, 15:31
I had the same problem. I removed the php-httpd package with:

ipkg remove php-httpd

and reinstalled it with:

ipkg install php-httpd

That works for me.

Best regards

mmX

wireless
02-08-2005, 17:39
I have a similar problem, yet I haven't found a solution for it sofar...

Before upgrading to the latest firmware from Oleg everything worked fine until I discovered yesterday that thttpd wasn't running anymore and php itself had issues as well. In the logs I found the following error (produced upon attempting to start thttpd):
attempt to access beyond end of device
07:11: rw=0, want=0, limit=Y where Y would be a number much larger than 0. This is weird because normally you will only get such an error if 'want' > 'limit'...

I decided to reset the wl500g to the factory settings and to reinstall everything on my usb stick. Unfortunately this didn't help either. Upon starting thttpd an error appears in the log stating "bind 0.0.0.0 - Address already in use". Changing the port in the conf file will not change this. If I specify a host value in the conf the error disappears, but still thttpd won't work (it will immediately terminate without any error, nor will an error appear in the logfiles).

uninstalling and reinstalling thttpd also didn't help. I'm too much in love with the current firmware to downgrade again to an older - less stable - firmware.

Frenck
04-08-2005, 11:13
Downgrading to a older firware does not change a thing, older firmwares will also install te latest version (ipkg does).

The remove & install I've already tried, no results :(

Tried some different ports ect, but still same errors :(

wireless
04-08-2005, 19:59
I'm too much in love with the current firmware to downgrade again to an older - less stable - firmware.
Well love is a curious thing :p I downgraded, reinstalled thttpd, uninstalled thttpd, repartitioned the usb stick, repeated the last three steps twice, installed an older version of thttpd without success, nearly gave up, tried a fresh reinstall for the last time and now it works :D
I'm still not sure why earlier attempts failed and why thttpd stopped working in the first place.

DeeJay
15-08-2005, 19:00
I'm also having this problem guys, and I cannot solve it with a re-install. This version is faulty, please roll back Unslung to an earlier version. THX.

Fama
16-08-2005, 17:16
Please get this fixed, I am having the same problem with the new version.
Uninstalling and reinstalling the new version doesn't work for me either.

DeeJay
20-08-2005, 16:00
Strange, I also have the bind error, when trying to connect to the box:

thttpd[196]: bind 0.0.0.0 - Address already in use

And if this is the problem, why is it that serving normal html content works, just php does not? The problem is with PHP here.

DeeJay
20-08-2005, 16:36
What is also strange these two lines in the log are sometimes missing:
(Once its there when I'm starting thttpd, once not)

thttpd/2.25b PHP/5.0.4 starting on port 8080
thttpd[276]: started as root without requesting chroot(), warning only

I'm now pretty sure, that this version is buggy. Please roll back to the old one, and php also. THX.

Jean-Fabrice
20-08-2005, 20:43
These lines are normal.
Please review your thttpd configuration file if you don't want such warning.

I'll give a look to thddpd optware when I got time.
btw, did you try surfing your wiley on port 8080 ?

JF

DeeJay
27-08-2005, 11:49
Of course. Now my status is the following:
When I get also this line, everything is ok:

thttpd/2.25b PHP/5.0.4 starting on port 8080

then the web server is working fine, and php also.
When I get only this:

thttpd[196]: bind 0.0.0.0 - Address already in use

then the web server is not working, and I keep restarting it until it starts working. It usually does after two or three restarts.

Tom_B
30-08-2005, 13:27
Hi,
I installing thttpd (using the mascat tutorial). It works fine except for the processor load it needs. If I do a 'top' after a reboot, thttpd has a load of 50-60% without that it is beeing used by me??

Does someone recognize this problem and now how to solve this??
Tom

nerodark
30-08-2005, 14:06
We need some more information:
What router's version are you using?
Do you have lots of clients connecting to your router on your thttpd's port?
Can we see your configuration file?
Is it only overloading on start-up?
Is it maintaining a high cpu load for more than 5 minutes?

britnet
30-08-2005, 14:38
I know this problem of thttpd, too.

Sometimes thttpd crashed during the start-up.
Then it needs a lot of cpu time.

kill it!
and restart it.

palbeda
01-09-2005, 09:17
I have the same problems with my wl500g:
- Heavy cpu usage (up to 90%)
- Sometimes crashing at start up
- Restarts do seem to help
- Incidental crashes
- Some php's that take more cpu power only work "sometimes"

My website is only used by a very limited number of people.

With the older version of thttpd I had none of these problems.
I like the features of the new version very much, but with these instabilities strongly limit the possibilities to actual use it :(

I was hoping somebody was able to provide a version that is tuned better for performance on the Asus.

Cheers Peter

Tom_B
01-09-2005, 14:55
I now just kill thttpd at reboot and then start this script (using init.d) which starts thttpd when it is not running (also to overcome the problem with random crashing). Not very elegant I know but if it works..... Tnx to rmdijkman for his help.

-----
<S10thttpdwatchdog>
#! /bin/sh

while [ `pidof thttpd` ] ; do
sleep 10
done

/opt/sbin/thttpd -C /opt/etc/thttpd.conf
/opt/etc/init.d/S10thttpdwatchdog &

simmetje
18-10-2005, 18:00
Hi all, after reading in these forum's for a while I burned the latest OLEG firmware in my 4 year old WL500G. I use the ASUS as an AP, its running in AP mode.
After that I started with the on-line manual: (http://www.macsat.com/php_web.php) to install a webserver. I connected a 512mb USB stick to the USB port where the webpages should land. Now everything is installed but the thttpd deamon doesn't start automatically. :confused: When I start thttpd manually it does not read the thttpd.conf file and therefor cannot find my index.htm.

Does anyone know why my thttpd does not start automatically?

Thnx,

Rob.

yeager
18-10-2005, 19:03
for me help this

/opt/etc/init.d/S80thttpd start

wireless
18-10-2005, 20:14
And then there's another option: the daemon is started but then thttpd is killed (by itself). You wouldn't be the first to experience some stability issues with thttpd ;). Try to restart the service a few times

simmetje
18-10-2005, 23:02
Running the /opt/etc/init.d/S80thttpd start manually works fine.
It look likes post-boot does not run automatically.....

Rob

yeager
19-10-2005, 07:55
after reboot
..root]#ps and you can see it is running or not

Styno
19-10-2005, 09:38
Simmetje: Place that line not in post-boot, but in post-mount instead. Your harddisk isn't mounted yet when you try to start the webserver.

simmetje
19-10-2005, 19:36
thnx, that did it...:D
creating a "post-mount" file with the "/opt/etc/init.d/S80thttpd start" in it solved the problem.
The thttpd daemon starts automatically now.

Great support,

Rob.

Styno
20-10-2005, 09:30
Please consider a small donation to this forum ;)

therealhunter
07-01-2006, 18:13
my post-mount file is always deleted, what can i do?

jonolumb
12-01-2006, 19:27
Check out this guide on committing changes to flash:
http://www.sprayfly.com/wiki/Committing_to_flash
Jono

VidJa
03-02-2006, 14:32
Hardware: WL500g with Oleg's Firmware v1.9.2.7 CR7b + 128 MB USB stick for swap and to hold pages for thttpd

This is what I want: from WAN pages served by thttpd, but no admin interface acces and admin acces from LAN. The whole point is not to have my Debian server switched on all day for the 1 or 2 requests i get per day. I'm not running any heavy stuff.

I followed the tutorals on macsat.com to install a thttpd webserver. I got the webserver working and I can access my own pages sitting on the USB stick from the LAN, however I cannot get it working from the WAN side without switching off the basic firewall rules in the admin interface.(not a wanted situation)

This is what I tried:

1) followed macsat tutorial
From WAN to <my_external_ip>:80 --> no response
From WAN to <my_external_ip>:81 --> no response
From LAN to 192.168.1.1:81-->thttpd served pages as expected
From LAN to <my_external_ip>:80-->thttpd served pages as expected
From LAN to 192.168.1.1:80-->admin interface as expected

2) switched off the basic firewall rules
result:
From WAN to <my_external_ip>:80 --> admin interface (not wanted from WAN)
From WAN to <my_external_ip>:81 --> thttpd served pages as expected
From LAN same as above

3) switched on the basic firewall rules again
removed the post-firewall script and in in admin interface:
added virtual-server on port 8000 to 192.168.1.100 to my debian server
added virtual-server on port 80 -->81 to 192.168.1.1 this should provide access to the thttpd pages
result:
From WAN to <my_external_ip>:80 --> no response
From WAN to <my_external_ip>:81 --> no response
From WAN to <my_external_ip>:8000 --> displays my pages on the debian server, so virtual server does work with other computer than router
From LAN same as all above

I also tried to forward port 80 to my debian server and that works as well.

this is the output I get in the system log when I try to access the pages sitting on the router either using port 80 or 81

Feb 3 13:42:27 kernel: DROPIN=eth1 OUT= MAC=<removed> SRC=<removed> DST=192.168.1.1 LEN=60 TOS=0x00 PREC=0x00 TTL=55 ID=33856 DF PROTO=TCP SPT=52132 DPT=81 SEQ=172141206 ACK=0 WINDOW=5840 RES=0x00 SYN URGP=0 OPT (020405B40402080A00F03A600000000001030302)

So I guess somewhere in the whole IPtables the request from the WAN gets dropped before it reaches the thttpd deamon.

Could anybody help me to solve this puzzle?

VidJa


---------------------------
Contents of /tmp/filter_rules
more filter_rules
*filter
:INPUT ACCEPT [0:0]
:FORWARD ACCEPT [0:0]
:OUTPUT ACCEPT [0:0]
:MACS - [0:0]
:SECURITY - [0:0]
:logaccept - [0:0]
:logdrop - [0:0]
-A INPUT -i br0 -j MACS
-A FORWARD -i br0 -j MACS
-A SECURITY -p tcp --syn -m limit --limit 1/s -j RETURN
-A SECURITY -p tcp --tcp-flags SYN,ACK,FIN,RST RST -m limit --limit 1/s -j RETURN
-A SECURITY -p udp -m limit --limit 5/s -j RETURN
-A SECURITY -p icmp -m limit --limit 5/s -j RETURN
-A SECURITY -j logdrop
-A INPUT -m state --state INVALID -j logdrop
-A INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT
-A INPUT -i lo -m state --state NEW -j ACCEPT
-A INPUT -i br0 -m state --state NEW -j ACCEPT
-A INPUT -i eth1 -m state --state NEW -j SECURITY
-A FORWARD -i br0 -o br0 -j ACCEPT
-A FORWARD -m state --state INVALID -j logdrop
-A FORWARD -m state --state ESTABLISHED,RELATED -j ACCEPT
-A FORWARD -i eth1 -m state --state NEW -j SECURITY
-A INPUT -p tcp -m tcp --dport 21 -j ACCEPT
-A INPUT -j logdrop
-A FORWARD -p tcp -m tcp -d 192.168.1.100 --dport 22 -j ACCEPT
-A FORWARD -p tcp -m tcp -d 192.168.1.1 --dport 81 -j ACCEPT
-A FORWARD -p udp --dport 6112 -j ACCEPT
-A logaccept -m state --state NEW -j LOG --log-prefix "ACCEPT " --log-tcp-sequence --log-tcp-options --log-ip-options
-A logaccept -j ACCEPT
-A logdrop -m state --state NEW -j LOG --log-prefix "DROP" --log-tcp-sequence --log-tcp-options --log-ip-options
-A logdrop -j DROP
COMMIT


Contents of /tmp/nat_rules
more nat_rules
*nat
:PREROUTING ACCEPT [0:0]
:POSTROUTING ACCEPT [0:0]
:OUTPUT ACCEPT [0:0]
-A PREROUTING -p tcp -m tcp -d <my_ip_address> --dport 22 -j DNAT --to 192.168.1.100
-A PREROUTING -p tcp -m tcp -d <my_ip_address> --dport 80 -j DNAT --to-destination 192.168.1.1:81
-A PREROUTING -p udp -d <my_ip_address> --sport 6112 -j NETMAP --to 192.168.1.0/24
-A POSTROUTING -p udp -s 192.168.1.0/24 --dport 6112 -j NETMAP --to <my_ip_address>
-A POSTROUTING -o eth1 ! -s <my_ip_address> -j MASQUERADE
-A POSTROUTING -o br0 -s 192.168.1.0/24 -d 192.168.1.0/24 -j MASQUERADE
COMMIT

Contents of /tmp/nat_rules
more nat_forward_rules
-A FORWARD -p tcp -m tcp -d 192.168.1.100 --dport 22 -j ACCEPT
-A FORWARD -p tcp -m tcp -d 192.168.1.1 --dport 81 -j ACCEPT
-A FORWARD -p udp --dport 6112 -j ACCEPT

VidJa
03-02-2006, 23:55
OK, It seems that after some reading up on IP tables the problem is solved, but in a different way than the tutorials suggest.
I don't know a lot about iptables so any suggestions are welcome from the pro's

This is what I did:
In the admin interface I set the Internet Firewall section I set Enable Firewall to 'YES'
In the Virtual Server section I enabled the virtual servers with my settings to be :

80 192.168.1.1 81 HTTP (forwards to thttpd on the router)
22 192.168.1.100 22 SSH (forwards to my LAN debian server)

then, I created a 'post-firewall script, but differently from the tutorials.

#!/bin/sh
iptables -I INPUT 7 -p tcp --dport 80 -j ACCEPT
iptables -I INPUT 8 -p tcp --dport 81 -j ACCEPT

save with the usual flashfs sequence.

the 7,8 and 9 are the places to insert in the INPUT chain as I understand correctly. It seems to be important to have the 81 in there to get connection to the internal thttpd server

After rebooting I logged in on my work server with ssh and did a wget myhomeip:80 and got the page served by thttpd.

The only drawback is now that the same page is also accessible from wget myhomeip:81
but that is no problem for me

alpha5
04-02-2006, 12:19
Hi there,

i´ve tried to setup a thttpd webserver with the macsat.com tutorial!
Firsttime i´ve started it, everything works fine, but now i allways get an errormessage in my /tmp/syslog.log:



Feb 4 12:03:48 thttpd[12727]: bind 0.0.0.0 - Address already in use


But it seems to be up and running:



# ps aux
...
12976 admin 2500 R /opt/sbin/thttpd -C /opt/etc/thttpd.conf
...


But it doesn´t answear on my http request!

This is my thttpd.conf:


port=81
dir=/opt/share/www
user=nobody
nochroot
nosymlink
logfile=/opt/var/log/thttpd.log
pidfile=/opt/var/run/thttpd.pid


It is started with via the init.d script with this command:



/opt/sbin/thttpd -C /opt/etc/thttpd.conf

mutejute
05-02-2006, 00:26
i had the same problem and went through a lot of troubles (tried different fw versions, installing, removing, reinstalling thttpd and php-thttpd, etc...).

now php-thttpd is working fine and im also running zina mp3 server (php-based) and it streams well.

what i did was i reformat my harddisk to ext3 and that solved the problem. there is a wiki page about wl-hdd, on how to format the harddisk. cant remember the link now, but you can search the forum here.

leadbelly
06-02-2006, 20:18
now php-thttpd is working fine and im also running zina mp3 server (php-based) and it streams well....

mutejute! I've been trying to get zina to run on my wl500 gx for a while, but at no succes...
Are you using it to stream out only, or are you also using it to control playback and stream internally?

I'm attempting to get zina to play out to my attached usb-soundcard..
so far, no goodd :-(

avberk
08-02-2006, 13:58
In your file: /usr/local/sbin/post-boot

Add the following 2 lines at the bottom:


sleep 30
/opt/etc/init.d/S80thttpd start


Don't forget to do:

flashfs save
flashfs commit
flashfs enable
reboot

afterwards.


Does this help?

oleo
09-02-2006, 09:15
Not post-boot but rather post-mount script
and maybe set

hostname=myhostname
if you having bind problems

ikerstges
13-02-2006, 19:53
I have the same problem....

On my system (wl500g with Oleg's 1.9.2.7-7b), I see that /opt/etc/init.d/rc.unslung is called from my /usr/local/sbin/post-boot.

This /opt/etc/init.d/rc.unslung takes care to automatically launch every script beginning with an "S" that is in /opt/etc/init.d/. The starting script for thhtpd is /opt/etc/init.d/S80thttpd. Currently, my syslog tells:


Jan 1 01:00:20 thttpd[148]: bind 0.0.0.0 - Address already in use


I have no /usr/local/sbin/post-mount file yet.

I have tried following:
a) Renamed /opt/etc/init.d/S80thttpd into: /opt/etc/init.d/thttpd (So it will not be part of /opt/etc/init.d/rc.unslung anymore)
b) Created /usr/local/sbin/post-mount with following content:


#!/bin/sh
/opt/etc/init.d/thttpd start

And make /usr/local/sbin/post-mount executable.
c) flashfs save - flashfs commit - flashfs enable and reboot.

After the reboot, I've checked the syslog about thttpd, but there is no entry at all! (Not even an error-message?!)

Maybe I'm very newbie in my approach, but now I have the question: what should I do?
Should I keep my wl500g just as it was and only add /usr/local/sbin/post-mount?
Does the /usr/local/sbin/post-mount require in the first line a: #!/bin/sh?

frankd
14-02-2006, 08:38
i had the same problem and went through a lot of troubles (tried different fw versions, installing, removing, reinstalling thttpd and php-thttpd, etc...).

now php-thttpd is working fine and im also running zina mp3 server (php-based) and it streams well.

what i did was i reformat my harddisk to ext3 and that solved the problem. there is a wiki page about wl-hdd, on how to format the harddisk. cant remember the link now, but you can search the forum here.

@mutejute:

php-thttpd is running fine with me @ WL-HDD on /opt partition on harddisk, using Oleg latest 1.9.2.7-7b.

zina setup gives more trouble than joy. Saving the file zina.ini.php sets all vars to empty strings.
Please can you post your thttpd setup and your zina setup to see whether I can learn someting from those?

And perhaps it is good to state your file locations as well.

thnx in advance.

mutejute
14-02-2006, 17:46
frankd,

i used to have problems with oleg + php-thttpd. it dies on me always. thttpd (without php) worked fine though. then i reformatted my harddisk to ext3, that solved the problem. but it was still unstable if i simultaneously access some files thru samba, and browsing my mp3s. php-thttpd cant handle it so it will just terminate and kill itself.

for oleg firmware, im using zina-0.10.27. this version works fine, but a little bit unstable (for creating session playlist), but most of the time, its working good. you cannot save settings using oleg+php-thttpd, at least with my setup. so what i did is i installed wamp (web server) and zina in my windows xp machine. i did the zina settings there and then copied the zina.ini.php to my wl-hdd hardrive. thats the alternative way of creating a zina config file.

my www location is at /opt/share/www. inside www is zina folder. inside zina are my mp3s (artist/album structure).

zina-0.11.xx doesnt work with oleg+php-thttpd. maybe you can modify the code but its better to just use the older version such as 0.10.xx . at macsat forum, someone there is using 0.10.28, but this version is not working with my setup (playlist is broken). i tried a few versions of zina until i found what works with me, and that is 0.10.27.

right now, im using openwrt with lighttpd and php4 installed. the latest stable version of zina (0.11.22) is working great with openwrt+lighttpd+php4. zina worked out of the box! no need to mess around with the code and settings. :)

mutejute
14-02-2006, 17:50
leadbelly,

im sorry but i use zina to play mp3s on the client side and not on the server. i think zina can play mp3s on the server because there is a setting for that. for linux, it has mpg123 option.

frankd
14-02-2006, 18:31
frankd,

<snip>

for oleg firmware, im using zina-0.10.27. this version works fine, but a little bit unstable (for creating session playlist), but most of the time, its working good. you cannot save settings using oleg+php-thttpd, at least with my setup. so what i did is i installed wamp (web server) and zina in my windows xp machine. i did the zina settings there and then copied the zina.ini.php to my wl-hdd hardrive. thats the alternative way of creating a zina config file.

my www location is at /opt/share/www. inside www is zina folder. inside zina are my mp3s (artist/album structure).

<snip>
right now, im using openwrt with lighttpd and php4 installed. the latest stable version of zina (0.11.22) is working great with openwrt+lighttpd+php4. zina worked out of the box! no need to mess around with the code and settings. :)

Thanks for this info.

I will stick with Oleg's fw, because the hassle to copy my current setup in openwrt is too much :mad:

So, I'll give obsolete zina a try.

Tamadite
05-03-2006, 00:37
My problems became solved when I moved the following line from post-boot to post-mount


# Run all active services - active means starts with S
/opt/etc/init.d/rc.unslung

MHz
11-07-2006, 14:35
Hello,

Is it possible to change the ERROR 404 Page?

If yes, how?

Thanks,


PcExpert

MMCM
12-07-2006, 09:52
http://www.acme.com/software/thttpd/thttpd_man.html#CUSTOM_ERRORS

MHz
12-07-2006, 11:35
The page tells me that the costum ERROR pages are stored in a directory named ERRORS. In the top of your web directory. But when I take a look in /opt/share/www there's only a cgi-bin and my own webpages. Am I doing something wrong?

Thanks

MMCM
12-07-2006, 11:58
You have to create a directory named /opt/share/www/errors
Then create err404.html there.
Check if permissions are set correctly.

Buld
15-09-2006, 13:42
I have WL-500gx with two USB keys, one for /opt and the other is an old 32mb that is used for swap. I've successfuly installed thttpd and run my php's quite well from WAN. The problem is that POSTing anything from WAN returns nothing. POSTing from LAN works without problems.
This is what thttpd.log says:

213.253.102.145 - - [15/Sep/2006:13:17:10 +0100] "POST /ccn/ccn.php HTTP/1.1" 0 0 "http://153.5.16.38/ccn/ccn.php
" "Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.0.6) Gecko/20060728 Firefox/1.5.0.6"
note two zeros after request string. First should be status code (e.g 200 for success) and the second should be bytes sent.

I'm thinking that POST data doesn't arrive to the server. This is my post-firewall (I have thttpd configured on port 8108 and enabled forwarding from 80 too):


#!/bin/sh
iptables -D INPUT -j DROP
#thttpd
iptables -A INPUT -p tcp --dport 8108 -j ACCEPT
iptables -A INPUT -p tcp --dport 80 -j ACCEPT
iptables -t nat -A PREROUTING -i $1 -p tcp --dport 80 -j DNAT --to-destination $4:8108
# ssh
iptables -A INPUT -p tcp --dport 22 -j ACCEPT
iptables -t nat -A PREROUTING -i $1 -p tcp --dport 22 -j DNAT --to-destination $4:22
# drop rest
iptables -A INPUT -j DROP

Any ideas?

Thanks in advance,
:cool:

JFK
01-10-2006, 19:04
Hi there,

is there someone, who is succesfully using WL-500gP as a web server with thttpd, php and mysql?

I'm trying to manage it for more than 14 days now, but still have problems. I'm using latest Oleg's firmware (1.9.2.7-7f-pre7). Then I installed ipkg and next thttpd (I also tried Apache instalation too, but I wasn't able to start httpd, so I installed thttpd instead of Apache).
After installing PHP I tried to install MySQL, but there were errors at the end of installation process...
Finally, I am able to connect to localhost MySQL server, but when I want to obtain some data from server, I receive error message like:


[ERROR] /opt/libexec/mysqld: Incorrect information in file: './mysql/host.frm'

Such type of error I receive every time, I want to select some data from any table. I tried to repair tables using myisamchk and REPAIR command, I tried also to delete them and make new ones, but the result is still the same. It is strange, that sometimes, after mysqld restart I can select some data from any table, but only from first table I tried to use SELECT command with. Other tables makes the same error messagess...
I already tried to copy tables files from another (functional) database, but the result was the same.

Dont you have the same troubles, or are you satisfied with your mysql?


I am not able to install/use php-mysql extension for thttpd too, but Im not sure, if is not because of wrong mysql installation/configuration.


Thank you for every reply...

Regards, JFK

oleo
02-10-2006, 01:27
The only way to get all three thing running is to have deluxe od premium with lot of swap (512MB at least) and installing alternative feed for Oleg firmware based on uClibc 0.9.28.
See http://ipkg.nslu2-linux.org/feeds/optware/oleg/cross/stable/

mysql needs some changes in scripts.

JFK
02-10-2006, 10:12
The only way to get all three thing running is to have deluxe od premium with lot of swap (512MB at least) and installing alternative feed for Oleg firmware based on uClibc 0.9.28.
See http://ipkg.nslu2-linux.org/feeds/optware/oleg/cross/stable/

mysql needs some changes in scripts.

Hi oleo,

thank you for your reply.

I tried to enlarge my swap adding 512MB to it, but there are still the same errors.

I'm not sure, that it is a question of memory, I thought about files locking or permittion troubles instead. But who knows? The strange thing is, that after connecting to mysqld server if I try to create another table, daemon makes table.frm file, but then mysql session freeze (I have to use Ctrl+c) and table.frm is every time the same (by my opinion unfinished = corrupted). But even when I copy correct table files instead, I'm still receiving errors...

Can I ask you to explain me your remark about uClibc library? Should I install uClibc package? Because I tried it too, but it caused more another problems. For example there was functionless find command, my ssh connection to ASUS device became unstable (connection was opened with no response) and so on... What firmware version should I use for my intended thttpd, php and mysql issues?


Best regards, JFK

oleo
03-10-2006, 00:28
Please read http://wl500g.info/showthread.php?t=2036 before asking any further.

Tamadite
22-10-2006, 11:12
Asus: WL-500g
Firmware: 1.9.2.7-7b

I have insalled both, thttpd and microperl, but it seems thttpd has problems to deal with cgi. If I execute a cgi test file to show "Hello world" from the command prompt it does work fine therefore no problems with microperl. If I execute the same file via web browser I get a blank page. If I kill thttpd and use busybox_httpd instead, it does work without problems. Some idea? Here you go the thttpd.conf file: (I do not use any extra parameter when calling thttpd)


dir=/tmp/harddisk/phpwebserver
port=8181
user=nobody
nochroot
nosymlink
novhost
logfile=/tmp/harddisk/log/thttpd.log
pidfile=/tmp/harddisk/run/thttpd.pid
cgipat=/cgi-bin/*
PS: if I use "chroot" instead of "nochroot" I get "500 Internal Error. There was an unusual problem serving the requested URL '/cgi-bin/test.cgi'"

Jarex
10-12-2006, 11:10
Hi,
I have a problem with auto recognizing codepage by either Mozilla or IE. I created website with charset=iso-8859-2 in HEAD section but whenever I access my website the codepage is not recognized and is set to 8859-1. Everytime I have to switch it manually. The codepage of the same website placed at public serwer is fine. I am running Oleg's firmaware 1.9.2.7-7f at WL-500g. Can anyone help me to fix it?

oleo
11-12-2006, 01:30
add
charset=iso-8859-2 line into /opt/etc/thttpd.conf

Jarex
11-12-2006, 10:55
Thx m8. That was it!!!!!:D :D :D :D

ny-ty
17-12-2006, 15:01
Hello, i have problem with thttpd, i install it with tutorial. I need RRDtool, but thttpd dont works. Ifi start it and look with nmap what on router runs @ what app listening. On port 8080 is thttpd here. Okay. I check it with browser http://my.router:8080/ .. nothing. Then i look with nmap again, but port 8080 is refused.. Thttpd calm down. Do you know why? thx for help

VidJa
29-12-2006, 10:30
I have exactly the same problem on my WL500g with the latest version of thttpd.

Tamadite
14-02-2007, 23:39
try...


iptables -D INPUT -j DROP
iptables -I INPUT -p tcp --dport 8108 -j ACCEPT
iptables -I INPUT -p tcp --dport 80 -j ACCEPT
iptables -t nat -A PREROUTING -i $1 -p tcp --dport 80 -j DNAT --to-destination $4:8108

iptables -A INPUT -j DROP

wraider1
07-07-2007, 22:43
I have followed http://www.sprayfly.com/wiki/THTTPD to set up web server on WLHDD it appears to be running but I do not get the "Hello World" index.htm.

Unable to connect
Firefox can't establish a connection to the server at 192.168.8.100:81:mad:

I have already set up the hard drive to auto mount and power down after 10 min. I do not understand why it will not show the page.
Here is what is running, and part of the log:
PID Uid VmSize Stat Command
1 root 564 S /sbin/init
2 root SW [keventd]
3 root SWN [ksoftirqd_CPU0]
4 root SW [kswapd]
5 root SW [bdflush]
6 root SW [kupdated]
7 root SW [mtdblockd]
46 root 316 S telnetd
51 root 368 S httpd
57 root 328 S klogd
58 root 356 S syslogd -m 0 -O /tmp/syslog.log -S -l 7
60 root 432 S udhcpc -i br0 -p /var/run/udhcpc_lan.pid -s /tmp/land
61 root SW [khubd]
69 root 340 S waveservermain
71 root 344 S rcamdmain
76 root 460 S watchdog
78 root 340 S ntp
84 root SW [kjournald]
96 root 1012 S /usr/sbin/smbd -D -l /opt/var/log/smbd.log -s /opt/et
98 root 1000 S /usr/sbin/nmbd -D -l /opt/var/log/nmbd.log -s /opt/et
133 root 556 S -sh
136 root 400 R ps

Dec 31 19:00:09 kernel: kjournald starting. Commit interval 5 seconds
Dec 31 19:00:09 kernel: EXT3-fs warning: maximal mount count reached, running e2fsck is recommended
Dec 31 19:00:09 kernel: EXT3 FS 2.4-0.9.19, 19 August 2002 on ide0(3,1), internal journal
Dec 31 19:00:09 kernel: EXT3-fs: recovery complete.
Dec 31 19:00:09 kernel: EXT3-fs: mounted filesystem with ordered data mode.
Dec 31 19:00:09 kernel: Adding Swap: 524276k swap-space (priority -1)
Jul 7 09:21:48 kernel: VFS: Can't find ext3 filesystem on dev ide0(3,0).
Jul 7 09:21:48 kernel: MSDOS FS: Using codepage 950
Jul 7 09:21:48 kernel: MSDOS FS: IO charset cp950
Jul 7 09:21:48 kernel: FAT: bogus logical sector size 0
Jul 7 09:21:48 kernel: VFS: Can't find a valid FAT filesystem on dev 03:00.
Jul 7 09:21:48 kernel: FAT: freeing iocharset=cp950
Jul 7 09:21:48 kernel: FAT: bogus logical sector size 0
Jul 7 09:21:48 kernel: VFS: Can't find a valid FAT filesystem on dev 03:00.
Jul 7 09:21:48 kernel: VFS: Can't find ext3 filesystem on dev ide0(3,2).
Jul 7 09:21:48 kernel: MSDOS FS: Using codepage 950
Jul 7 09:21:48 kernel: MSDOS FS: IO charset cp950
Jul 7 09:21:48 kernel: FAT: bogus logical sector size 0
Jul 7 09:21:48 kernel: VFS: Can't find a valid FAT filesystem on dev 03:02.
Jul 7 09:21:48 kernel: FAT: freeing iocharset=cp950
Jul 7 09:21:48 kernel: FAT: bogus logical sector size 0
Jul 7 09:21:48 kernel: VFS: Can't find a valid FAT filesystem on dev 03:02.
Jul 7 09:21:57 ntp client: Synchronizing time with time.nist.gov ...
Jul 7 09:22:12 nmbd[98]: [2007/07/07 09:22:12, 0] nmbd/nmbd_become_lmb.c:become_local_master_stage2(405)
Jul 7 09:22:12 nmbd[98]: *****
Jul 7 09:22:12 nmbd[98]:
Jul 7 09:22:12 nmbd[98]: Samba name server ~1~ is now a local master browser for workgroup STARGATE on subnet 192.168.8.100
Jul 7 09:22:12 nmbd[98]:
Jul 7 09:22:12 nmbd[98]: *****
Jul 7 16:34:13 login[133]: root login on `pts/0'

UG:mad: :eek: :(
Thanks!

wraider1
07-07-2007, 22:54
oh, I am running WLHDD-1.9.2.7-7g:)

w00blyn
31-07-2007, 09:11
Hello
I've installed thttpd, but I'm having trouble running it. I get a
thttpd: can't load library 'libiconv.so.2'

same with
php: can't load library 'libiconv.so.2'

I cannot find it in the loaded modules:


[admin@(none) root]$ ls -l /opt/lib
drwxr-xr-x 5 admin root 4096 Jul 30 22:56 ipkg
lrwxrwxrwx 1 admin root 15 Jul 30 22:54 libbz2.so -> libbz2.so.1 .0.4
lrwxrwxrwx 1 admin root 15 Jul 30 22:54 libbz2.so.1.0 -> libbz2. so.1.0.4
-rw-r--r-- 1 admin root 85420 Jul 24 10:26 libbz2.so.1.0.4
lrwxrwxrwx 1 admin root 18 Jul 30 22:55 libcrypto.so -> libcrypt o.so.0.9.7
lrwxrwxrwx 1 admin root 18 Jul 30 22:55 libcrypto.so.0 -> libcry pto.so.0.9.7
-rw-r--r-- 1 admin root 1681632 Jun 21 22:12 libcrypto.so.0.9.7
-rwxr-xr-x 1 admin root 1201316 Jun 21 22:09 libdb-4.2.so
lrwxrwxrwx 1 admin root 12 Jul 30 22:55 libdb-4.so -> libdb-4.2. so
lrwxrwxrwx 1 admin root 12 Jul 30 22:55 libdb.so -> libdb-4.2.so
lrwxrwxrwx 1 admin root 18 Jul 30 22:55 libexslt.so -> libexslt. so.0.8.13
lrwxrwxrwx 1 admin root 18 Jul 30 22:55 libexslt.so.0 -> libexsl t.so.0.8.13
-rwxr-xr-x 1 admin root 109364 Jun 30 22:30 libexslt.so.0.8.13
lrwxrwxrwx 1 admin root 12 Jul 30 22:06 libform.so -> libform.so .5
lrwxrwxrwx 1 admin root 14 Jul 30 22:06 libform.so.5 -> libform. so.5.6
-rwxr-xr-x 1 admin root 81708 Jun 21 22:10 libform.so.5.6
lrwxrwxrwx 1 admin root 16 Jul 30 22:55 libgdbm.so -> libgdbm.so .3.0.0
lrwxrwxrwx 1 admin root 16 Jul 30 22:55 libgdbm.so.3 -> libgdbm. so.3.0.0
-rwxr-xr-x 1 admin root 28108 Jun 21 22:07 libgdbm.so.3.0.0
lrwxrwxrwx 1 admin root 23 Jul 30 22:55 libgdbm_compat.so -> lib gdbm_compat.so.3.0.0
lrwxrwxrwx 1 admin root 23 Jul 30 22:55 libgdbm_compat.so.3 -> l ibgdbm_compat.so.3.0.0
-rwxr-xr-x 1 admin root 9868 Jun 21 22:07 libgdbm_compat.so.3.0.0
lrwxrwxrwx 1 admin root 12 Jul 30 22:06 libmenu.so -> libmenu.so .5
lrwxrwxrwx 1 admin root 14 Jul 30 22:06 libmenu.so.5 -> libmenu. so.5.6
-rwxr-xr-x 1 admin root 37724 Jun 21 22:10 libmenu.so.5.6
lrwxrwxrwx 1 admin root 15 Jul 30 22:06 libncurses.so -> libncur ses.so.5
lrwxrwxrwx 1 admin root 17 Jul 30 22:06 libncurses.so.5 -> libnc urses.so.5.6
-rwxr-xr-x 1 admin root 395372 Jun 21 22:10 libncurses.so.5.6
lrwxrwxrwx 1 admin root 13 Jul 30 22:06 libpanel.so -> libpanel. so.5
lrwxrwxrwx 1 admin root 15 Jul 30 22:06 libpanel.so.5 -> libpane l.so.5.6
-rwxr-xr-x 1 admin root 18060 Jun 21 22:10 libpanel.so.5.6
lrwxrwxrwx 1 admin root 16 Jul 30 22:55 libpcre.so -> libpcre.so .0.0.1
lrwxrwxrwx 1 admin root 16 Jul 30 22:55 libpcre.so.0 -> libpcre. so.0.0.1
-rwxr-xr-x 1 admin root 163804 Jun 21 22:12 libpcre.so.0.0.1
lrwxrwxrwx 1 admin root 19 Jul 30 22:55 libpcrecpp.so -> libpcre cpp.so.0.0.0
lrwxrwxrwx 1 admin root 19 Jul 30 22:55 libpcrecpp.so.0 -> libpc recpp.so.0.0.0
-rwxr-xr-x 1 admin root 71624 Jun 21 22:12 libpcrecpp.so.0.0.0
lrwxrwxrwx 1 admin root 21 Jul 30 22:55 libpcreposix.so -> libpc reposix.so.0.0.0
lrwxrwxrwx 1 admin root 21 Jul 30 22:55 libpcreposix.so.0 -> lib pcreposix.so.0.0.0
-rwxr-xr-x 1 admin root 7352 Jun 21 22:12 libpcreposix.so.0.0.0
lrwxrwxrwx 1 admin root 15 Jul 30 22:55 libssl.so -> libssl.so.0 .9.7
lrwxrwxrwx 1 admin root 15 Jul 30 22:55 libssl.so.0 -> libssl.so .0.9.7
-rw-r--r-- 1 admin root 289980 Jun 21 22:12 libssl.so.0.9.7
lrwxrwxrwx 1 admin root 17 Jul 30 22:55 libxml2.so -> libxml2.so .2.6.29
lrwxrwxrwx 1 admin root 17 Jul 30 22:55 libxml2.so.2 -> libxml2. so.2.6.29
-rwxr-xr-x 1 admin root 2093076 Jun 30 22:30 libxml2.so.2.6.29
drwxr-xr-x 2 admin root 4096 Jun 30 22:30 libxslt-plugins
lrwxrwxrwx 1 admin root 17 Jul 30 22:55 libxslt.so -> libxslt.so .1.1.21
lrwxrwxrwx 1 admin root 17 Jul 30 22:55 libxslt.so.1 -> libxslt. so.1.1.21
-rwxr-xr-x 1 admin root 347264 Jun 30 22:30 libxslt.so.1.1.21
lrwxrwxrwx 1 admin root 13 Jul 30 22:55 libz.so -> libz.so.1.2.3
lrwxrwxrwx 1 admin root 13 Jul 30 22:55 libz.so.1 -> libz.so.1.2 .3
-rw-r--r-- 1 admin root 92468 Jun 21 22:14 libz.so.1.2.3
drwxr-xr-x 3 admin root 4096 Jul 30 22:54 php
drwxr-xr-x 2 admin root 4096 Jul 30 22:55 pkgconfig
lrwxrwxrwx 1 admin root 17 Jul 30 22:06 terminfo -> ../share/ter minfo
-rw-r--r-- 1 admin root 216 Jun 30 22:30 xml2Conf.sh
-rw-r--r-- 1 admin root 250 Jun 30 22:30 xsltConf.sh


Is anyone having similar trouble? Maybe this is a problem with the latest php package?

avberk
31-07-2007, 09:54
Just a wild guess. Try this:

ipkg install gconv-modules

sven7
12-08-2007, 08:18
Hi W00biyn,

I am a newbie and I have the same issue too. I search and play around with it 3 days and finally got it there. Try to install it as:

ipkg install libiconv

then, my http works :D

hope that can help : )

w00blyn
15-08-2007, 05:56
thank you! it works great now. at last i have access to my 100 gigs of music on my psp.

vaikis
19-11-2007, 22:17
Hello, maybe somebody can give example how to configure thttpd for virtual hosting, have one external IP.

JFK
31-12-2007, 11:07
Hi there,
I would like to run thttpd web server on my WL-500gP.

After installation (with ipkg) it really works, but only until next reboot of whole device. Then it refuse start with error message Segmentation Fault. No more error messages. Running with -V it prints:

[admin@asus root]$ thttpd -V
thttpd/2.25b PHP/5.2.5
User defined signal 1


Running with -D it prints:

[admin@asus root]$ thttpd -D
Segmentation fault


My thttpd.conf:

dir=/opt/share/www
port=8080
user=nobody
nochroot
nosymlink
novhost
logfile=/opt/var/log/thttpd.log
# Please do not edit pidfile path at it is use to kill thttpd process during init
pidfile=/opt/var/run/thttpd.pid


My ipkg.conf:

src wl500g http://wl500g.dyndns.org/ipkg
#src unslung http://www.wlan-sat.com/boleo/optware/oleg
src unslung http://ipkg.nslu2-linux.org/feeds/optware/oleg/cross/stable
dest root /


My versions of packages:
ipkg - 0.99.149-2
php - 5.2.5-1
php-thttpd - 2.25b-5.2.5-1


Does anyone have idea why it happens or what to do to solve it?

Thanks a lot...#JFK

raas
31-12-2007, 16:16
Hi,

I don't know why or how this happened., still to much of a n00b.
my guess is something went wrong with the filesystem.

I had the same message, with another program/file though..

I fixed it with e2fsck like in the following post http://www.wl500g.info/showthread.php?t=12188

one warning though.. I don't know much about the use of e2fsck , so I don't know what effects it could cause, do some research on it.

darius
17-07-2008, 16:32
Hi,

don't need mysql, php, just httpd and /www directory on my usb pendrive.
Is it possible to have it on original updated firmware by Asus
(lost hidden menu access to terminal command line ).

Darius


The only way to get all three thing running is to have deluxe od premium with lot of swap (512MB at least) and installing alternative feed for Oleg firmware based on uClibc 0.9.28.
See http://ipkg.nslu2-linux.org/feeds/optware/oleg/cross/stable/

mysql needs some changes in scripts.

rector_bogdan
16-10-2008, 10:56
Hi,
i want to use torrentflux and i need to upload .torrent file but the upload file in thttpd is not working.
I tryed to recompile thttpd 2.25b with php 5.2.5 (i found a patch to suport thttpd 2.25b) but i get some errors at parse_date.c .(segmentation fault)
I also tryed to use apache ,lighttpd and i have the same problem ...
plz help

rector_bogdan
18-10-2008, 00:28
When i compile the thttpd 2.25b patched with php i get the following error:
php_thttpd.c: In function 'do_writev':
php_thttpd.c:110: error: 'IOV_MAX' undeclared (first use in this function)
php_thttpd.c:110: error: (Each undeclared identifier is reported only once
php_thttpd.c:110: error: for each function it appears in.)
php_thttpd.c: In function 'thttpd_request_dtor':
php_thttpd.c:475: warning: passing argument 1 of 'free' discards qualifiers from pointer target type
php_thttpd.c:488:2: error: #error No thread primitives available
php_thttpd.c: In function 'worker_thread':
php_thttpd.c:616: error: 'tsrm_ls' undeclared (first use in this function)
make: *** [php_thttpd.o] Error 1

Willie2_z
28-09-2009, 15:58
A simple question.

I have a thttpd deamon running om my wl500gx.
Is it possible to make a directory with admin/root rights ? and only that specific folder.

Thanks in advance.

avberk
28-09-2009, 19:41
chmod the directory i would assume. What are you trying to achieve?

DrChair
28-09-2009, 21:55
From the man-page of thttpd:

BASIC AUTHENTICATION
Basic Authentication is available as an option at compile time. If enabled, it uses a password file in the directory to be protected, called .htpasswd by default. This file is formatted as the familiar colon-separated username/encrypted-password pair, records delimited by newlines. The protection does not carry over to subdirectories. The utility program htpasswd(1) is included to help create and modify .htpasswd files.

And as far as I can tell, it's enabled by default.

So creating a .htpasswd file in each directory you want to protect should work

Willie2_z
29-09-2009, 08:38
thanks to the both of you.
I used both things.
.htpasswd to set up some security on the directory, and chown on the directory, so it's possible to delete a certain file...

kokoro
02-03-2010, 02:37
Hi,

I try to install gallery 2.3.1, but at step 4 (storage creation) the installation is crashing with the server.

I would like to take valuable traces from the web server or php, to know if the problem comes from my server configuration, a missing ipkg that is needed by a basic dev function of the gallery installer, or the gallery installer itself.

After the click, it is like the webserver is freezed (no action: page is loading, no error page) and after 6-10minutes, the page becomes empty/released meanwhile the thttpd process is stopped.
Here is the last line of the only server traces with no relevant information /opt/var/log/thttpd.log in our case:


192.168.3.254 - - [28/Feb/2010:23:28:34 +0100] "GET /gallery2/install/index.php?step=4 HTTP/1.1" 200 8493 "http://xxxxxxxxxx/gallery2/install/index.php?step=3" "Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; .NET CLR 1.1.4322; MS-RTC LM 8; .NET CLR 2.0.50727; .NET CLR 3.0.04506.648; .NET CLR 3.5.21022)"


Is there a way to increase level of traces of php-thttpd webserver ?

And/or do you have an idea of a missing ipkg?


ANNEXES

Here are my ipkg
apr - 1.3.12-1
apr-util - 1.3.9-1
autoconf - 2.63-1
automake - 1.10-2
bash - 3.2.49-1
bison - 2.4.1-1
buildroot - 4.1.1-13
bzip2 - 1.0.5-2
coreutils - 8.4-1
cyrus-sasl-libs - 2.1.23-1
diffutils - 2.9-1
e2fslibs - 1.41.9-1
enhanced-ctorrent - dnh3.3.2-11
expat - 2.0.1-1
ffmpeg - 0.svn20080409-2
file - 5.04-1
findutils - 4.2.32-1
flex - 2.5.35-1
freetype - 2.3.6-1
gawk - 3.1.7-1
gdbm - 1.8.3-2
groff - 1.19.2-2
gzip - 1.2.4a-4
imagemagick - 6.5.5.10-1
ipkg-opt - 0.99.163-10
libart - 2.3.17-2
libdb - 4.2.52-3
libidn - 1.16-1
libjpeg - 6b-3
liblcms - 1.15-1
libpng - 1.2.42-1
libtiff - 3.9.2-1
libtool - 1.5.26-1
libuclibc++ - 0.2.2-8
libxml2 - 2.7.6-1
libxslt - 1.1.26-1
m4 - 1.4.13-1
make - 3.81-2
microperl - 5.8.8-11
mysql - 4.1.22-3
nano - 2.2.1-1
ncurses - 5.7-1
ncursesw - 5.7-1
neon - 0.29.3-1
openldap-libs - 2.3.43-1
openssh-sftp-server - 5.3p1-1
openssl - 0.9.7m-5
optware-devel - 6.8-10
patch - 2.6.1-1
pcre - 8.01-1
perl - 5.8.8-23
php - 5.2.12-1
php-mbstring - 5.2.12-1
php-mysql - 5.2.12-1
php-pgsql - 5.2.12-1
php-thttpd - 2.25b-5.2.12-1
pkgconfig - 0.15.0-2
postgresql - 8.2.13-2
python25 - 2.5.5-2
readline - 6.1-1
rrdtool - 1.2.30-1
rsync - 3.0.7-1
screen - 4.0.3-2
sed - 4.2.1-1
sqlite - 3.6.22-1
svn - 1.6.9-1
tar - 1.22-2
tcl - 8.4.19-2
termcap - 1.3.1-2
uclibc-opt - 0.9.28-13
wget-ssl - 1.12-2
zlib - 1.2.3-3
php-curl php-dev php-fcgi php-gd php-imap php-ldap php-mbstring php-pear php-xmlrpc


Gallery suspected function causing thttpd crash:
(otherwise probe html file would have been deleted)

install/steps/StorageSetupStep.class
function _isStoragePathWebAccessible


/**
* Try to protect the given folder with a .htaccess file from direct web-access.
* And then check if the given folder is web-accessible either way.
* Precondition: gallery and g2data folders exist.
*
* @return array(boolean false if check procedure failed due to platform issues,
* boolean true if the folder is accessible from the web (=insecure))
*/
function _isStoragePathWebAccessible($dir) {
/* Check if we can use fsockopen. Else we can't test it at all. */
if (!function_exists('fsockopen')
|| in_array('fsockopen', preg_split('/,\s*/', ini_get('disable_functions')))) {
return array(false, false);
}

/* Add a .htaccess file. */
if (!secureStorageFolder($dir)) {
return array(false, false);
}
/* Add a probe file. */
$probeFileName = 'probe_' . substr(md5(uniqid(rand())), 0, 10) . '.html';
$probeFilePath = $dir . $probeFileName;
$checkString = md5(rand());
$fh = @fopen($probeFilePath, 'w');
if ($fh) {
$contents = "<html><head><title>Probe</title><body>$checkString</body></html>";
fwrite($fh, $contents);
fclose($fh);
}

if (!file_exists($probeFilePath)) {
return array(false, false);
}

/* Try to guess the URL to the g2data folder. */
$storageUrlCandidates = array();
/* Get the URL of the G2 folder. */
$galleryUrl = getGalleryDirUrl();
/* Get the relative path of the g2data folder to the gallery dir. */
$storagePath = realpath($dir);
$galleryPath = realpath(dirname(dirname(dirname(__FILE__))));
if (strpos($storagePath, $galleryPath) === 0) {
/* The g2data folder is within the gallery folder. */
$relativeStoragePath = substr($storagePath, strlen($galleryPath) + 1);
$relativeStoragePath = str_replace("\\", '/', $relativeStoragePath);
$storageUrlCandidates[] = $galleryUrl . $relativeStoragePath . '/';
} else {
/*
* The g2data folder is in another directory tree.
* Try to remove the common part of the paths and then construct a URL.
*/
$galleryPathElements = explode(DIRECTORY_SEPARATOR, $galleryPath);
$storagePathElements = explode(DIRECTORY_SEPARATOR, $storagePath);
$max = 30;
/* Before: e.g. /foo/bar/gallery2/ and /foo/bar/g2data/. */
while (!empty($galleryPathElements) && !empty($storagePathElements) && $max-- > 0
&& $galleryPathElements[0] == $storagePathElements[0]) {
array_shift($storagePathElements);
array_shift($galleryPathElements);
}
/* After, e.g. /g2data/ (common part removed). */
$relativeStoragePath = implode('/', $storagePathElements);

$storageUrlCandidates[] = getBaseUrl() . '/' . $relativeStoragePath . '/';
if (preg_match('!^.*?://.*?/[^/]+!', $galleryUrl, $matches)) {
$storageUrlCandidates[] = $matches[0] . '/' . $relativeStoragePath . '/';
}
}

/* Also try the default path and other common paths. */
$storageUrlCandidates[] = $galleryUrl . basename($dir) . '/';
$storageUrlCandidates[] = getBaseUrl() . '/' . basename($dir) . '/';

/* Try to fetch the probe file. */
$isAccessible = false;
foreach ($storageUrlCandidates as $storageFolderUrl) {
$url = $storageFolderUrl . $probeFileName;
list ($urlFetched, $isAccessible) = $this->_isUrlAccessible($url, $checkString);
if ($urlFetched && $isAccessible) {
$isAccessible = true;
break;
}
}

/* Cleanup: Delete the probe file. */
unlink($probeFilePath);

return array(true, $isAccessible);
}

fragu
23-05-2010, 11:46
Hello ppl,

I am trying to get the Zenphoto gallery working on a wl500gp.

I managed to get Mysql working.
I tried with lighttpd but without success. Tried the Thttpd -- i think beter.

The problem and the question:
php.log gives me the following errors and I can't find anything on them or how to fix this:


Module compiled with module API=20060613, debug=0, thread-safety=1
PHP compiled with module API=20060613, debug=0, thread-safety=0



AND this happens with every module I try to load. How to match thread-safety???

HELP?

wpte
23-05-2010, 18:02
What exactly didn't work with the lighttpd?
have you tried my how-to: http://wl500g.info/showthread.php?t=20306 if so, please tell me what went wrong so I can improve it:)

lighttpd is a lot better for web packages like Zenphoto gallery, especially when you'd like to share it with the world.