DSM-G600, DNS-3xx and NSA-220 Hack Forum

Unfortunately no one can be told what fun_plug is - you have to see it for yourself.

You are not logged in.

Announcement

#26 2006-10-28 17:53:36

TheWalt
Member
Registered: 2006-09-12
Posts: 39

Re: lighttpd + php

sala wrote:

Re-compiled. This time it's modular, so you need to setup php.ini for modules.
http://dns323.kood.org/downloads/php-4.4.4.tar.bz2

Doesn't seem to work... phpinfo returns  Dynamic Library support not available  so I can't load any of the *.so extensions.

Also php -m from command line says the same thing.

Help?  smile

Offline

 

#27 2006-10-28 18:21:13

sala
Member / Site Admin
From: Estonia
Registered: 2006-07-28
Posts: 731
Website

Re: lighttpd + php

Damn yikes
I totaly forget that, uploading fixed version at monday smile


DSM-G600 - NetBSD hdd-boot - 80GB Samsung SP0802N
NSA-220 - Gentoo armv5tel 20110121 hdd-boot - 2x 2TB WD WD20EADS

Offline

 

#28 2006-10-28 19:41:59

TheWalt
Member
Registered: 2006-09-12
Posts: 39

Re: lighttpd + php

sala wrote:

Damn yikes
I totaly forget that, uploading fixed version at monday smile

Sweet, thanks.  I can live without thumbs til then big_smile

Offline

 

#29 2006-10-30 09:03:37

sala
Member / Site Admin
From: Estonia
Registered: 2006-07-28
Posts: 731
Website

Re: lighttpd + php

Actually there is nothing more to build in. Did you set enable_dl = On or enable_dl = 1 in your php.ini ?
By default php.ini path is /mnt/HD_a2


DSM-G600 - NetBSD hdd-boot - 80GB Samsung SP0802N
NSA-220 - Gentoo armv5tel 20110121 hdd-boot - 2x 2TB WD WD20EADS

Offline

 

#30 2006-10-30 14:52:40

TheWalt
Member
Registered: 2006-09-12
Posts: 39

Re: lighttpd + php

sala wrote:

Actually there is nothing more to build in. Did you set enable_dl = On or enable_dl = 1 in your php.ini ?
By default php.ini path is /mnt/HD_a2

I think there is a switch needed.  http://us3.php.net/gd for example refers to a --with-jpeg-dir=DIR

The bundled GD I think is fine, just needs this switch in addition to the regular --with-gd , don't know if the library is there by default though (seems like it says it is).

Offline

 

#31 2006-10-30 15:08:55

sala
Member / Site Admin
From: Estonia
Registered: 2006-07-28
Posts: 731
Website

Re: lighttpd + php

I was talking about dynamic modules.
Anyways --with-jpeg-dir and --with-png-dir is already added along with --with-gd=shared. I also hex searched and all jpeg and png functions is there smile


DSM-G600 - NetBSD hdd-boot - 80GB Samsung SP0802N
NSA-220 - Gentoo armv5tel 20110121 hdd-boot - 2x 2TB WD WD20EADS

Offline

 

#32 2006-10-30 16:19:02

TheWalt
Member
Registered: 2006-09-12
Posts: 39

Re: lighttpd + php

sala wrote:

I was talking about dynamic modules.
Anyways --with-jpeg-dir and --with-png-dir is already added along with --with-gd=shared. I also hex searched and all jpeg and png functions is there smile

I knew that.  *looks around*  What I get for reading forums so early.  Let me check tonight, I'm just using the default php.ini that comes with 4.4.4 so that may be the issue.  The way it read I thought it was a compile time switch, not runtime.

Thanks

Offline

 

#33 2006-10-30 17:34:10

sala
Member / Site Admin
From: Estonia
Registered: 2006-07-28
Posts: 731
Website

Re: lighttpd + php

Damn, it still says

Code:

2006-10-30 18:31:50: (mod_fastcgi.c.2502) FastCGI-stderr: PHP Warning:  dl() [<a href='function.dl'>function.dl</a>]: Cannot dynamically load /mnt/HD_a2/website/gd.so - dynamic modules are not supported in /mnt/HD_a2/website/pages/_index.php on line 2

I have no ideas any more.

php is configured:

Code:

'./configure' '--target=powerpc-uclibc-linux-gnu' '--host=i686-linux-gnu' '--build=powerpc-uclibc-linux-gnu' '--disable-all' '--enable-session' '--enable-fastcgi' '--with-config-file-path=/mnt/HD_a2' '--enable-magic-quotes' '--enable-memory-limit' '--enable-force-cgi-redirect' '--enable-discard-path' '--without-pear' '--without-gettext' '--without-iconv' '--with-pcre-regex=shared' '--with-gd=shared' '--with-zlib' '--with-jpeg-dir' '--with-png-dir' '--with-mysql=shared' '--enable-sockets=shared' '--enable-mbstring=shared' '--enable-shared'

I guess it is because of --disable-all but we should still be able to enable --enable-shared and any other parameter disabled by --disable-all.

//edit
Ok, now I got it, it's because of uclibc libdl.so, somehow php does not like it.


DSM-G600 - NetBSD hdd-boot - 80GB Samsung SP0802N
NSA-220 - Gentoo armv5tel 20110121 hdd-boot - 2x 2TB WD WD20EADS

Offline

 

#34 2006-10-31 17:23:15

sala
Member / Site Admin
From: Estonia
Registered: 2006-07-28
Posts: 731
Website

Re: lighttpd + php

OK, I managed to go around libdl.so problem, now it supports dynamic modules tongue

Only gd.so will need some tweaks, now it outputs after loading:

Code:

 Can't modify ./gd.so's text section. Use GCC option -fPIC for shared objects, please.

DSM-G600 - NetBSD hdd-boot - 80GB Samsung SP0802N
NSA-220 - Gentoo armv5tel 20110121 hdd-boot - 2x 2TB WD WD20EADS

Offline

 

#35 2006-11-10 01:22:36

TheWalt
Member
Registered: 2006-09-12
Posts: 39

Re: lighttpd + php

Thanks for the working php-gd, now my file server is complete smile

Offline

 

#36 2006-11-10 10:20:13

sala
Member / Site Admin
From: Estonia
Registered: 2006-07-28
Posts: 731
Website

Re: lighttpd + php

I just couldn't make it as a module. So as TheWalt says, if gd is needed then use php-gd instead of php.
All files are as usual in http://dns323.kood.org/downloads/php-4.4.4.tar.bz2


DSM-G600 - NetBSD hdd-boot - 80GB Samsung SP0802N
NSA-220 - Gentoo armv5tel 20110121 hdd-boot - 2x 2TB WD WD20EADS

Offline

 

#37 2006-11-11 19:01:05

tksm
Member
Registered: 2006-09-27
Posts: 16

Re: lighttpd + php

i got php workin this way and everythings sweet when i access the page on my network but if i try to access it via the internet i get "invalid request"
whats wrong here

Offline

 

#38 2006-11-11 19:24:03

sala
Member / Site Admin
From: Estonia
Registered: 2006-07-28
Posts: 731
Website

Re: lighttpd + php

tksm wrote:

i got php workin this way and everythings sweet when i access the page on my network but if i try to access it via the internet i get "invalid request"
whats wrong here

Is your dsmg connected directly to internet? If not then you need to setup your router to allow port forwarding.
Also your service provider may block some or all ports you are trying to use.


DSM-G600 - NetBSD hdd-boot - 80GB Samsung SP0802N
NSA-220 - Gentoo armv5tel 20110121 hdd-boot - 2x 2TB WD WD20EADS

Offline

 

#39 2006-11-11 19:28:01

tksm
Member
Registered: 2006-09-27
Posts: 16

Re: lighttpd + php

lol never mind it was my php index file had some f-ed up code in it , i got it now

Last edited by tksm (2006-11-11 19:28:35)

Offline

 

#40 2006-11-24 15:24:09

art
Member
From: Germany
Registered: 2006-11-24
Posts: 8

Re: lighttpd + php

Hi TheWalt.

Thanks for your detailed description. It worked out of the box for me after I followed your instructions.
However I wanted to mention that despite the builtin admin interface by default will block port 80, you can still force lighttpd to listen on port 80.

The trick is to shutdown/finish the webserver (e.g. I do this from fun_plug), then start lighttpd on port 80 and afterwards to restart the builtin web server. After I had a quick peek into the sources that D-Link has provided in the meantime, I saw that this GoAhead server will do up to 5 reattempts to open a listening socket if the default one is not available. It will simply probe ports 81, 82, ... 84.
Therefore in our case it will end up with port 81 since lighttpd blocked 80.
Stopping the builtin web server is as easy as a kill $WEBS_PID, which WEBS_PID=`pidof webs` will determine.

Find attached a snipplet from the fun_plug I use.
I have all my stuff organized such that beside the fun_plug,  there's only a single directory addons which hold something similar to a unix file hierarchy, e.g. addons/etc, addons/bin, addons/web etc.
My lighttpd modules are in addons/lib/lighttpd, lighttpd's config file is in addons/etc/lighttpd.conf.
There's a central rc.config file in addons/etc that fun_plug will source include and that will control which service will be started and which won't (Remember - I posted only a snipplet from the whole fun_plug script.
Actually there's much more like starting telnetd, drobbear etc.)

rc.config is just a plain file:

Code:

START_TELNETD=no
START_SSHD=yes
START_LIGHTTPD=yes
LIGHTTPD_PORT=80

My lighttpd.conf is exactly as yours except for the port which is 80 for me. However, as you can see in the attachment,
this will be replaced by the value you specified in rc.config anyway.

Having things set up this way will turn the DSM-G600 in an almost regular web server on e.g. http://192.168.10.101
while the builtin admin interface will still be available and fully functional at http://192.168.10.101:81

Hope that this might be useful for somebody out there as well. ;-)

Art
PS: Note the use of boot log files in the script. This turned out to be quite a useful stuf in case things do not work as expected.

Offline

 

#41 2006-11-24 16:14:04

sala
Member / Site Admin
From: Estonia
Registered: 2006-07-28
Posts: 731
Website

Re: lighttpd + php

If you don't need internal webserver then you can also remove it.

Code:

kill `pidof chkbutton`
kill `pidof webs`

But with this method you are going to lose some process checking features, maybe also shutdown by button, usb dismount button and error emailing.
To get around this you can kill just webs and then fake /web/webs process by replacing /web/webs symlink with something else. Removing /web/webs symlink completely should also work smile


DSM-G600 - NetBSD hdd-boot - 80GB Samsung SP0802N
NSA-220 - Gentoo armv5tel 20110121 hdd-boot - 2x 2TB WD WD20EADS

Offline

 

#42 2006-11-27 18:06:53

TheWalt
Member
Registered: 2006-09-12
Posts: 39

Re: lighttpd + php

art wrote:

However I wanted to mention that despite the builtin admin interface by default will block port 80, you can still force lighttpd to listen on port 80.

I use my router to forward external port 80 requests to internal port so it's transparent, but this is nice to know also.  Thanks for the info.

Here is my updated lighttpd.conf file since my origional posting.  Other then this, I use the default php.ini and everything has been stable thus far.

Offline

 

#43 2006-12-18 06:43:05

Wolfie
Member
Registered: 2006-12-16
Posts: 15

Re: lighttpd + php

Can't modify /usr/local/lib/mod_dirlisting.so's text section. Use GCC option -fPIC for shared objects, please.

Help?

Using the lighttpd.conf that TheWalt last provided got me further than before, because I was having that same error but with mod_rewrite.so file.  I've modified the .conf file with my settings (my folder setup, IP and ports, but not modifying other stuff).

Did I miss something totally obvious or is there a trick that I haven't thought of yet?  If I do php -m, I get the following:

[PHP Modules]
session
standard
zlib

[Zend Modules]

Do I need a php.ini file?  If so, where do I place it and where can I get a copy of one that I can use (and obviously customize)?


I'm not a n00b to the Linux OS & structure, but I have lost touch with it, unfortunately, so please resist the urge to reach through the computer to strangle me. smile

Offline

 

#44 2006-12-19 17:33:52

TheWalt
Member
Registered: 2006-09-12
Posts: 39

Re: lighttpd + php

Attached is the php.ini I use.  Just the default.

One thing to keep in mind for my conf is you need the following in your lighttpd folder.
A few of the so's are loaded by default even though not explicit in the conf file.

lighttpd.conf
lighttpd.css
lighttpd
mod_alias.so
mod_auth.so
mod_dirlisting.so
mod_fastcgi.so
mod_indexfile.so
mod_staticfile.so
mod_status.so
pcre.so
php.ini
php
sockets.so

Offline

 

#45 2006-12-19 19:35:45

Wolfie
Member
Registered: 2006-12-16
Posts: 15

Re: lighttpd + php

Still getting the error with mod_dirlisting.so, and now I'm hunting around for lighttpd.css (first mention I've seen of it).

Does it matter that I'm running it from the root user?

Offline

 

#46 2006-12-21 07:01:29

TheWalt
Member
Registered: 2006-09-12
Posts: 39

Re: lighttpd + php

Wolfie wrote:

Still getting the error with mod_dirlisting.so, and now I'm hunting around for lighttpd.css (first mention I've seen of it).

Does it matter that I'm running it from the root user?

lighttpd.css is just a custom style sheet and is not actually required.  I run mine from root and it has been up for 31 days and counting.

Offline

 

#47 2006-12-21 08:15:40

sala
Member / Site Admin
From: Estonia
Registered: 2006-07-28
Posts: 731
Website

Re: lighttpd + php

Wolfie wrote:

Still getting the error with mod_dirlisting.so

Are you using the latest lighttpd from http://dns323.kood.org/downloads/ ?
Also don't mix modules from different versions/build date of lighttpd.


DSM-G600 - NetBSD hdd-boot - 80GB Samsung SP0802N
NSA-220 - Gentoo armv5tel 20110121 hdd-boot - 2x 2TB WD WD20EADS

Offline

 

#48 2006-12-21 09:20:55

Wolfie
Member
Registered: 2006-12-16
Posts: 15

Re: lighttpd + php

lighttpd-ssl-pcre-1.4.13.tar.bz2 -and- php-4.4.4.tar.bz2

I didn't download any of the other lighttpd's nor php's, although to be certain, I will re-extract the archive to be certain.

---

Deleted all the files in the directory, except for the .conf file.  Re-extracted the lighttpd files only (from the archive listed above).  Same error.

Even tried doing the same thing but the other 1.4.13 files, same results.  (Always deleting the current files, then extracting).  I'm sure there's something simple that I'm not doing right.

Question, would permissions cause this error?

Offline

 

#49 2007-06-03 08:37:24

mykroft
Member
Registered: 2007-05-12
Posts: 83

Re: lighttpd + php

Any chance you can cross compile either 4 or 5 for the 323 - I have hit a wall and cant figure out what is wrong with my compile sad

Thanks
Myk

Offline

 

#50 2007-06-03 16:31:51

Wolfie
Member
Registered: 2006-12-16
Posts: 15

Re: lighttpd + php

mykroft:

The forum you want is http://dns323.kood.org/forum/viewforum.php?id=3


Threads about lighttpd:
> http://dns323.kood.org/forum/t530-light … vious.html
> http://dns323.kood.org/forum/t213-lighttpd.html


Thread about php http://dns323.kood.org/forum/t260.html

I don't know if any of that will answer what you are looking for, but since some people only read forums that interest them, your question is more likely to be answered there.  (Of course, the all knowing sala might still answer it...)

smile

Offline

 

Board footer

Powered by PunBB
© Copyright 2002–2010 PunBB