Guys,
Can someone write a short introduction to help me get PHP running on my router. I'm not using the default httpd (just for admin gui) but I run busybox_httpd. Now i want to make it possible to run php.
please help me out!
RoNin
Printable View
Guys,
Can someone write a short introduction to help me get PHP running on my router. I'm not using the default httpd (just for admin gui) but I run busybox_httpd. Now i want to make it possible to run php.
please help me out!
RoNin
On the OpenWRT forum I found this:
http://davidoffdotnet.net/openwrt/ipkg/
There are the following packages which provide PHP for the Linksys WRT54g, so they might work on the WL-500g as well:
The first seems to me a simple php library (I don't know what its features are).Code:Package: lwhp
Version: 1.0.0
Section: net
Architecture: mipsel
Maintainer: sam <sam@davidoffdotnet.net>
MD5Sum: 96bd50f8625f94f54e62255456b3a683
Size: 143640
Filename: lwhp_1.0.0_mipsel.ipk
Source: http://davidoffdotnet.net/openwrt/ip...0.0_mipsel.ipk
Description: a lightweight hypertext processor
Package: thttpd-php
Version: 2.21b-2
Section: net
Architecture: mipsel
Maintainer: sam <sam@davidoffdotnet.net>
MD5Sum: b0660a8072d3c9bfd42a26fccf7571c4
Size: 402230
Filename: thttpd-php_2.21b-2_mipsel.ipk
Source: http://davidoffdotnet.net/openwrt/ip...b-2_mipsel.ipk
Description: The thttpd webserver compiled with php4 support.
The second package contains a webserver.
I hope this is helpful and, as allways, if it works for you please report back here :)
I've tryed these packages, but after starting the php application died with 'Segmentation Fault' error. Can anybody write me how to make install these packages correctly? I'm newbie in LINUX :-(
My configuration is: ASUS WL-500GX, Firmware 1.9.2.7 RC2 (OLEG)
Please help me out.
SC
Packages: http://davidoffdotnet.net/openwrt/ipkg/
You have to replace the current firmware by OpenWRT if you wish to use OpenWRT packages. Read at least this thread: http://wl500g.info/showthread.php?t=...hlight=openwrt The firmware download link seems to be dead at the moment but it should be available soon.
Any possibilities on cross-comping these applications to Asus source tree?
I gave it a try and compiled these.
Here is PHP3 & thttpd (without PHP4). I'll give the thttpd+php4 combi another try later, but sofar that resulted in a long list of errors
For me it is working on 1.9.2.7-2 software.
Good luck
Eric,
Thanks for PHP stuff.
I tried these programs, but the browser sends me this message:
403 Forbidden
The requested URL '/index.html' resolves to a file which is marked executable but is not a CGI file; retrieving it is forbidden.
Can you tell me the correct setup process to WL-500GX device?
My configuration is: ASUS WL-500GX, Firmware 1.9.2.7 RC2 (OLEG)
SC
-----------------
Here is PHP3 & thttpd (without PHP4). I'll give the thttpd+php4 combi another try later, but sofar that resulted in a long list of errors
For me it is working on 1.9.2.7-2 software.
Good luck[/QUOTE]
same issue for me. php works fine, script can be run from command line.
Seems this problem is due to the fact, that fat/fat32 is not a native linux filesystem, i.e. it does not have all required file attributes, so by default all files on the fat volumes are executable. So, either thttpd or it config should be adjusted to check for file extension or particular directory, or alternatively you could switch to ext3 filesystem.
You're going far on this one Oleg :D
Use this command instead to run thttpd from sbin folder:
Problem is the cgipat variable not set up in thttpd.confCode:./thttpd -C ../etc/thttpd.conf -c /cgi-bin/*
This team is working great, but most of the site library are in PHP4. I will wait for your try in compiling V4 or try it myself out of despair ;-)
if you want to compile it for yourself, you need to build it statically with uClib from CVS. Than apply the paches for dns.c & remove the problems with testing in ./configure
uClib that is standard for the WL500g supplied won't work cuz of missing functions (e.g. in dns.c)
Unfortunately I'm still struggling to get a decent new up2date toolchain working. For the rest it should comile without many problems. Oh you need to take an older version of thhtpd as the most recent version (ahum dec 2003) is not supported.
haha, my last try ended this way :eek: :confused:
gcc -IZend/ -I/usr/local/root/php-4.3.9/Zend/ -DPHP_ATOM_INC -I/usr/local/root/php-4.3.9/include -I/usr/local/root/php-4.3.9/main -I/usr/local/root/php-4.3.9 -I/usr/local/root/thttpd-2.21b -I/usr/local/root/php-4.3.9/Zend -D_XPG_IV -I/usr/local/root/php-4.3.9/TSRM -g -O2 -c /usr/local/root/php-4.3.9/Zend/zend_execute.c -o Zend/zend_execute.o && echo > Zend/zend_execute.lo
gcc: Internal error: Terminated (program cc1)
Please submit a full bug report.
See <URL:http://gcc.gnu.org/bugs.html> for instructions.
make: *** [Zend/zend_execute.lo] Error 1
This looks ugly. What about trying to staticaly link it to glibc (using mipsel-linux toolchain from firmware?) I've had good result for my xmail project, where the uclibc where insuficient.
Also the -IZend/ looks strange, if not worst. Where is this folder come from? is it a cutted path?
the result is an enormous file. I did it first with the PHP3, I believe it resulted in a 3MB file dynamically! linked vs 700k static linked uClib.Quote:
Originally Posted by hugo
1 sec, I'll give it a try and let u know.
also read my edited comment about -IZend/
Ok, here is a working minimal build of the PHP4 enabled thhtpd
The extensions are mostly disabled now, I'll see if I can build one that is more 'feature enabled'
Yummy. Going to test this... Thanks Erik
THTTPD works fine... :-)
Which PHP commands are implemented? (The PHP echo is correct! ;-))
SC
Most command are working.
Funnily, preg_replace() doesn't, even if other text replace command do :confused:
Ok and here is the (almost)full version.
For me to sucessfully run it I have to add some swap space
With this one I sucessfully run some of the nice scripts like Gallery & phpsysinfo
Good luck
It is working fully for me. Even without swap space... Thanks for this Erik
I can run guppy PHP server as frontend on the WL-hhd. Thats cool for testing and debugging.
It works me too. Thanks for creators... :)
Here is a modified script to get HD info under phpsysinfo. You must replace the corresponding file in /include/os in your phpsysinfo root
I tried the modified script. Correct!!! :)
It seems the more we have, the more we want. I Would like to add some libs. Did you have to modify your source? or was it a makefile optimisation story?
Would you mind giving here your make info to add our own libs to the process?
How do I install this?Quote:
Originally Posted by erik_bies
I use Firmware v.1.9.2.7 CR3
copy it to router using ftp, run it using telnet
something like ./thttpd-php4f_2.21b-2_mipsel -p 81 -d yoursourcefolder
put some php files in the source folder, give them enough rights (get up stand up!) and learn how to use php.
take the config file out of the PHP3 package
than take the thhtpd+PHP4 file.
edit the script with your desired directories. dump some files in the www directory (from config file)
run
thttpd -C thttp.conf
make sure ur running it on a port different from port 80
there is a small change in the dns.c, and fiddeling with makefiles for the remaining. I'll try to dig up and make a wiki pageQuote:
It seems the more we have, the more we want. I Would like to add some libs. Did you have to modify your source? or was it a makefile optimisation story?
Would you mind giving here your make info to add our own libs to the process?
BTW. thanks for the patch of the Linux.inc.php file. Do you maybe know why it does not want to see the 2nd file system?
It it shown using a mount command?
Hmm, I'm giving phpsysinfo (2.3) a try and I get the following error:Any ideas?Code:Error: Linux is not currently supported
This version is working fully on my box. Most of the script is using system command. If some are unavailable, it won't be able to run. Do you have any specific firmware?
Oh, yes, I forgot: 1.8.1.7 CR3. I'm not running from rootfs. I did see Oleg upped 1.9.2.7 CR3b on which I was waiting, so I'll be happy to upgrade.
It has been tested on the latest Oleg firmware, so yes it should work.
Still no luck :o
Here's what I've done so far:
- Upgraded to latest custom firmware 1.9.2.7 CR3b from Oleg (ofcourse :))
- Created an ext3 partition on my HDD, initialized it and mounted it on /tmp/extra:
- Then I've copied the first build from erik_bies (the one with the subdirectories) to the ext3 partition and updated the thttpd program with the latest build with PHP4 support.Code:mkdir /tmp/extra
mount -o rw /dev/scsi/host0/bus0/target0/lun0/part5 /tmp/extra
- I changed the rights of several directories:
I've noticed that the /www directory needs execute priviledges, otherwise the webserver will report an '500 - internal server error'.Code:drw-r--r-- 2 admin nobody 1024 Jan 15 15:23 etc
drwx------ 2 admin root 12288 Jan 15 00:26 lost+found
drw-r--r-- 3 admin nobody 1024 Jan 15 15:23 man
drw-r--r-- 2 admin nobody 1024 Jan 15 15:23 sbin
drwxr-xr-x 4 admin nobody 1024 Jan 15 15:23 www
- I copied phpsysinfo-dev into the /www directory and also into the /www/cgi-bin directory.
- I've renamed the config.php.new to config.phpCode:drwxr-xr-x 3 admin nobody 1024 Jan 15 15:28 cgi-bin
-rw-r--r-- 1 admin nobody 323 Jan 4 00:30 index.html
drwxr-xr-x 5 admin nobody 1024 Jan 15 15:42 phpsysinfo-dev
When I request the index.html page it says:
When I request the phpsysinfo page (http://wl500g:81/phpsysinfo-dev) it says:Code:If you see this you are sucessfully running thttpd on wl500x
Also when I request the same page from cgi-bin (http://wl500g:81/cgi-bin/phpsysinfo-dev) it says the same as above.Code:Error: Linux is not currently supported
I've also written a test php script which I placed into the /www and the /www/cgi-bin folder, and in both cases the script worked perfect (Hello World).
My conclusion so far is: PHP is running fine, I only need some extra stuff for phpsysinfo. Any ideas what might cause the phpsysinfo to report the error?
Styno:
I had the same problem with phpsysinfo that it said that Linux was not supported.
The problem was that phpsysinfo looks for a file called class.Linux.inc.php in sysinfo/includes/os/
I had that file but with a lowercase L in the word class.Linux.inc.php.
Moved the file with
and it worked fine after that.Code:mv class.linux.inc.php class.Linux.inc.php
Hope this will work for you too.
Yep, that was my problem too, among with some other files who were also lowercase. It's because I copied the files through a SAMBA share (which converts every file/dir to lowercase) that I had this problem.Quote:
Originally Posted by Jaap
So to everyone: Do not unpack the files to a SAMBA share, because it will break the website.
Thanks Jaap!
Starting with 1.9.2.7-3 samba preserves file case (i.e. required options are set in the config file).
FYI
By default thttpd is trying to load whole page to memory before sending it to client. This means that kernel will kill it, when somebody wants to download any huge file from your web.
But it can be changed! Look for following lines in configure script:
> if test "$cross_compiling" = yes; then
> ac_cv_func_mmap_fixed_mapped=no
WL500g CAN do mmap, so you can set ac_cv_func_mmap_fixed_mapped to yes.
Then thttpd only memory-maps file and big files are served without impact on free memory.
Friend compiled it for me, but without PHP.
where does it go wrong with me ??
When i install the thttpd with php is works great on *.html and *.php
After rebooting my wl500g
and start the ./thttpd -C ../etc/thttpd.conf -c /cgi-bin/* again
i get this on *.html :(
403 Forbidden
The requested URL '/' resolves to a file which is marked executable but is not a CGI file; retrieving it is forbidden.
*.php still works fine.
You will have to do a chmod -x on all html files. Also the filesystem needs to be ext2 or ext3 (on FAT filesystems all files have execute rights).