Running PHP on a ADDON GWAR3000

Utilities and tools for networking, routers, setup etc
lukegb
Novice
Novice
Posts: 16
Joined: Thu Jul 05, 2007 7:23 pm

Running PHP on a ADDON GWAR3000

Post by lukegb » Fri Jul 06, 2007 9:23 pm

I've moved the "normal" administration interface to port 8700 and have started a different thttpd instance on port 80, pointing to a minix partition: "/nvram/wwwroot".
I was wondering how I could run PHP under thttpd, or compile code on my PC (probably thtttpd-php) and make a new firmware image containing the updated binaries.

USING FIRMWARE VERSION: RouterTech_3.6.0D_20070604_2.30 (20070604172601)
Alex Atkin
Novice
Novice
Posts: 37
Joined: Fri Feb 09, 2007 6:39 am

Post by Alex Atkin » Sat Jul 07, 2007 1:20 am

Surely it will not have enough RAM?
lukegb
Novice
Novice
Posts: 16
Joined: Thu Jul 05, 2007 7:23 pm

Good point...

Post by lukegb » Sat Jul 07, 2007 7:31 am

That's probably a good point, I'll try and see.
User avatar
thechief
RouterTech Team
RouterTech Team
Posts: 12067
Joined: Wed Feb 01, 2006 10:22 pm
Location: England, the Centre of Africa
Contact:

Post by thechief » Sat Jul 07, 2007 8:45 am

Depending on the size of the new binaries and the size of your minix partition, your problem could be the size of the flash (i.e., whether there would be sufficient space to flash the new firmware). If you need to free some space, you can always delete the tcl interpreter (ettclsh) and any DSP or ATM driver that you will never use).
The Chief: :afro: Be sure to read the Firmware FAQ and do a Forum Search before posting!
No support via PM. Ask all questions on the open forum.
Alex Atkin
Novice
Novice
Posts: 37
Joined: Fri Feb 09, 2007 6:39 am

Post by Alex Atkin » Sun Jul 08, 2007 3:32 am

Obviously you have to bear in mind that even if it DOES have enough RAM to run PHP (and when I say enough RAM I mean to run any useful scripts ON PHP), it might fall over running PHP AND some complex routing at the same time. They do not seem to leave much leeway in these routers or indeed any consumer router when it comes to RAM.

My 2WIRE BT Business Hub is one of the best routers I have known and even THAT seems to assign the web interface a low priority so it doesn't impact on the actual routing performance. Its dead annoying actually as when im doing heavy downloading it can take 10 seconds for any page on the web interface to load. However it shows how even business grade routers have barely enough RAM and CPU capacity to do their job under heavy load.
lukegb
Novice
Novice
Posts: 16
Joined: Thu Jul 05, 2007 7:23 pm

Sorry

Post by lukegb » Sun Jul 08, 2007 12:23 pm

Sorry, just want to clarify:

I HAVE GOT a BT Home Hub that will do all the routing, so I've turned pretty much all the other functions off'
Wireless, DHCP server, Routing, everything.

I only keep the original web interface so that I can perform F/W upgrades, but using the H/Hub this blocks off this port and redirects it to an access denied page on the GWAR3000.

I apologize for not making this clear.

EDIT: The reason I use the GWAR is because it is quieter than my normal PC, which does have Apache, MySQL and PHP installed.
Alex Atkin
Novice
Novice
Posts: 37
Joined: Fri Feb 09, 2007 6:39 am

Post by Alex Atkin » Tue Jul 10, 2007 10:47 pm

Makes sense, but exactly what kind of scripts are you planning to run? I cant imagine much useful stuff that you could use it for without MAJOR firmware hacking so that you can save stuff to the FLASH. Most of the stuff I do on my Apache box is accessing content ON that box, monitoring the router, stuff you NEED a PC to do.
User avatar
thechief
RouterTech Team
RouterTech Team
Posts: 12067
Joined: Wed Feb 01, 2006 10:22 pm
Location: England, the Centre of Africa
Contact:

Post by thechief » Tue Jul 10, 2007 11:16 pm

With v2.3, stuff can easily be saved to Flash (minix partition).
The Chief: :afro: Be sure to read the Firmware FAQ and do a Forum Search before posting!
No support via PM. Ask all questions on the open forum.
lukegb
Novice
Novice
Posts: 16
Joined: Thu Jul 05, 2007 7:23 pm

Not sure yet...

Post by lukegb » Wed Jul 11, 2007 5:23 pm

Normally I just put all kinds of stuff on my Apache box and I'm looking for a lightweight CMS, but I'll probably just use my own if I have to (it'll use a flat file to read and save from/to).
Hardware:
[s]Router[/s] Wi-fi AP is an ADDON GWAR3000 running PSPBoot and the v2.3 firmware.
Wi-fi REPEATER is a Linksys WRE54G Wireless-G Range Expander (v.3)
Router is a BT Home Hub (1st v. hardware with 6.2.6.E BT FON firmware)
PC is a Shuttle PC running Vista, Mac, XP and OpenSUSE 10.2.
Alex Atkin
Novice
Novice
Posts: 37
Joined: Fri Feb 09, 2007 6:39 am

Post by Alex Atkin » Wed Jul 11, 2007 7:16 pm

That sounds pretty cool, if my friend ever brings back his SafeCom router that he is no longer using (uni student and is moving back home soon, his roommate got Sky and is using their garbage router now instead) then perhaps I will give it a shot myself. He never got round to installing the RouterTech firmware on it despite putting up with it corrupting the configuration on a regular basis.
lukegb
Novice
Novice
Posts: 16
Joined: Thu Jul 05, 2007 7:23 pm

Can't build

Post by lukegb » Wed Jul 11, 2007 11:19 pm

I can't even BUILD the lighttpd server or php for cross-compile for mips under Suse or Fedora 7 (under VMware).
I'm using a compile script, which is posted elsewhere - which i can't find ATM - and the toolkit suggested but it just compiles it for my standard (i686) platform.

Chief, where am i supposed to get the extensions to put on my Samba for the lighttpd server you posted in the RT F/W v2.3 Discussion thread?
Hardware:
[s]Router[/s] Wi-fi AP is an ADDON GWAR3000 running PSPBoot and the v2.3 firmware.
Wi-fi REPEATER is a Linksys WRE54G Wireless-G Range Expander (v.3)
Router is a BT Home Hub (1st v. hardware with 6.2.6.E BT FON firmware)
PC is a Shuttle PC running Vista, Mac, XP and OpenSUSE 10.2.
User avatar
thechief
RouterTech Team
RouterTech Team
Posts: 12067
Joined: Wed Feb 01, 2006 10:22 pm
Location: England, the Centre of Africa
Contact:

Re: Can't build

Post by thechief » Wed Jul 11, 2007 11:52 pm

lukegb wrote:I can't even BUILD the lighttpd server or php for cross-compile for mips under Suse or Fedora 7 (under VMware).
I'm using a compile script, which is posted elsewhere - which i can't find ATM - and the toolkit suggested but it just compiles it for my standard (i686) platform.
It will compile for the AR7 platform (after some code patches) if you are using the correct compiler and you supply the correct arguments to the "configure" script.
lukegb wrote:Chief, where am i supposed to get the extensions to put on my Samba for the lighttpd server you posted in the RT F/W v2.3 Discussion thread?
I am not sure I understand which extensions you are referring to. If they are lighttpd stuff then they should already be in the source code distribution.
The Chief: :afro: Be sure to read the Firmware FAQ and do a Forum Search before posting!
No support via PM. Ask all questions on the open forum.
lukegb
Novice
Novice
Posts: 16
Joined: Thu Jul 05, 2007 7:23 pm

Post by lukegb » Sat Jul 14, 2007 7:34 am

I've manually patched in (crudely) some enviroment variables to the start of the configure script, deleted -std=gnu99 and ran:

Code: Select all

# ./configure --host=mips
What I'm talking about is the extensions for the server you posted on the forum, as without them, it will not run.[/code]
Hardware:
[s]Router[/s] Wi-fi AP is an ADDON GWAR3000 running PSPBoot and the v2.3 firmware.
Wi-fi REPEATER is a Linksys WRE54G Wireless-G Range Expander (v.3)
Router is a BT Home Hub (1st v. hardware with 6.2.6.E BT FON firmware)
PC is a Shuttle PC running Vista, Mac, XP and OpenSUSE 10.2.
User avatar
thechief
RouterTech Team
RouterTech Team
Posts: 12067
Joined: Wed Feb 01, 2006 10:22 pm
Location: England, the Centre of Africa
Contact:

Post by thechief » Sat Jul 14, 2007 8:39 am

I would imagine that your PATH is not correct, and the wrong compiler is being called. You need to ensure that the correct compiler is being called. You can amend this script to suit your needs

Code: Select all

#!/bin/bash
# ----------------------------------------------------------------------------------- 
#  - Shell script to build stuff for AR7 routers, using the "hardhat" cross compiler toolchain
#  - It will look for the configure script either in the current directory
#  - or in the one immediately below
#  - Author: thechief
# ----------------------------------------------------------------------------------- 

# --- fix the paths
export PATH=/opt/hardhat/previewkit/mips/mipsel-linux-uclibc/bin:/opt/hardhat/previewkit/mips/fp_le/bin:$PATH
export C_INCLUDE_PATH=/opt/hardhat/previewkit/mips/mipsel-linux-uclibc/include
export LIBRARY_PATH=/opt/hardhat/previewkit/mips/mipsel-linux-uclibc/lib/
export GCC_EXEC_PREFIX=/opt/hardhat/previewkit/mips/fp_le/lib/gcc-lib/
export LD_LIBRARY_PATH=$LIBRARY_PATH

# --- fix other variables
CROSS_COMPILE=mipsel-uclibc
AS=$CROSS_COMPILE-as
LD=$CROSS_COMPILE-ld
CC=$CROSS_COMPILE-gcc
RANLIB=$CROSS_COMPILE-ranlib
CPP="$CROSS_COMPILE-gcc -E"
AR=$CROSS_COMPILE-ar
NM=$CROSS_COMPILE-nm
STRIP=$CROSS_COMPILE-strip
OBJCOPY=$CROSS_COMPILE-objcopy
OBJDUMP=$CROSS_COMPILE-objdump
CFLAGS="-Os -s -ffunction-sections -fdata-sections"
LDFLAGS="-Wl,--gc-sections"

# export all this stuff
export AS LD CC CPP AR NM STRIP OBJCOPY OBJDUMP CFLAGS RANLIB LDFLAGS

# --------------------------------------------------------------------
#
#       Now, let us do the stuff!
#
# --------------------------------------------------------------------

# --- default prefix
PREFIX=$HOME/ar7_bins

# --- the machine we are building for
TARGET_PLATFORM=mips

# --- the system that we are using to build for the host (target) platform
BUILD_PLATFORM=mipsel-unknown-linux-gnu 

# --- default configure
CONFIG=./configure

# --- does it exist?
if ! test -e $CONFIG; then
  CONFIG=./Configure
fi

if ! test -e $CONFIG; then
  CONFIG=../configure
fi

if ! test -e $CONFIG; then
  CONFIG=../Configure
fi

# --- bomb out if a configure script is not found
if ! test -e $CONFIG; then
   echo "I cannot find any configure script in either '$PWD' or '$PWD/..' "
else
   # run "configure" with 
   echo "Running $CONFIG" 
   $CONFIG --prefix=$PREFIX --host=$TARGET_PLATFORM --build=$BUILD_PLATFORM "$@"
   make
fi

The Chief: :afro: Be sure to read the Firmware FAQ and do a Forum Search before posting!
No support via PM. Ask all questions on the open forum.
lukegb
Novice
Novice
Posts: 16
Joined: Thu Jul 05, 2007 7:23 pm

Bumpety :(

Post by lukegb » Sat Oct 06, 2007 11:01 pm

Sorry about the bump but...

Where do you get the toolchain from? I've just been trying to use a plain old vanilla gnu compiler that came with my system and I can't seem to find the toolchain anywhere.
Hardware:
[s]Router[/s] Wi-fi AP is an ADDON GWAR3000 running PSPBoot and the v2.3 firmware.
Wi-fi REPEATER is a Linksys WRE54G Wireless-G Range Expander (v.3)
Router is a BT Home Hub (1st v. hardware with 6.2.6.E BT FON firmware)
PC is a Shuttle PC running Vista, Mac, XP and OpenSUSE 10.2.
Post Reply