OpenWrt Forum Archive

Topic: php on busybox? possible?

The content of this topic has been archived on 28 Mar 2018. There are no obvious gaps in this topic, but there may still be some posts missing at the end.

I have made (per the tutorial) busybox run administration on port 81 and serve port 80 to another web directory.  Is it possible for me to add php to busybox rather than have to use thttpd or lighthttpd? all I'm after is taking a form submission into flat text files.  If this can be done without adding php I'd love to know how.

thanks!
delirium

Install php4/5 (cgi).

Add the following line to /etc/httpd.conf:

*.php:/usr/bin/php

Restart httpd:

/etc/init.d/httpd restart

Create a file, phpinfo.php in /www/cgi-bin with the following:

<?php
phpinfo();
?>

Point your browser at the file and thats it.

(Last edited by osmosis on 12 Jun 2007, 21:14)

hey thanks alot! theres only a few things I'm having trouble with (perhaps because I'm trying this in dd-wrt), I can't find a http.conf int the etc folder, nor could I try writing one in winscp because it said that was a non writable folder

Sorry, the file was called httpd.conf and should already exist if the busybox httpd was installed.

I don't use a squash filesystem so my instructions may have limited mileage for you????

Using OpenWRT you would have real filesystem.

Otherwise, ask questions in DD-WRT forums not OpenWRT Kamikaze.

(Last edited by vincentfox on 12 Jun 2007, 21:31)

i am using the newest copy of kamikaze on a fonera and I can't find the httpd.conf file, but I know that busy box is working because I can browse to anything I've put in the www folder

http://wiki.openwrt.org/OpenWrtDocs/httpd.conf

If you read to the bottom of the page, it explains that the httpd within busybox runs in a default configuration without httpd.conf. Simply create the httpd.conf file within your etc folder, restart httpd as explained by osmosis and it will digest the new configuration.

Does that clear anything up?

thanks for helping me out, I really appreciate it!

unfortunately I get this error when trying to access phpinfo.php

Security Alert! The PHP CGI cannot be accessed directly.

This PHP CGI binary was compiled with force-cgi-redirect enabled. This means that a page will only be served up if the REDIRECT_STATUS CGI variable is set, e.g. via an Apache Action directive.

For more information as to why this behaviour exists, see the manual page for CGI security.

For more information about changing this behaviour or re-enabling this webserver, consult the installation file that came with this distribution, or visit the manual page.

make these changes in php.ini will allow php to work!!!

thanks for your help everyone!


cgi.force_redirect = 0
cgi.redirect_status_env ="yes";

Hi,

I tried all i sexplained here.
For this I let the luci httpd settings to the port 80.
Due to not enough space I installed PHP on the USB key.

I followed these instructions :
Add the following line to /etc/httpd.conf:
Code:
*.php:/usr/bin/php

Restart httpd:
Code:
/etc/init.d/httpd restart

TO USE A DIFFERENT WWW place I created a WWW on the US Key and I followed the instructions by :
Create a file, phpinfo.php in /www/cgi-bin with the following:
Code:
<?php
phpinfo();
?>

I also installed a simple index.html on the /www (USB Key)

I also followed the instruction by adding :
cgi.force_redirect = 0
cgi.redirect_status_env ="yes";

On the php.ini which is on the USB Key.

I also (personnaly) added those lines in the /etc/config/httpd file :
option 'port'    '81'
option 'home'  '/mnt/usbdrive-1/www'

I also do httpd -p 81 -c /etc/httpd.conf (explained by sn4ke in https://forum.openwrt.org/viewtopic.php?id=21450).

1) The problem is when I use this URL (http://192.168.1.1:81) it well display my index file but directly goes (automatically) to http://192.168.1.1:81/cgi-bin/luci by giving a 404 not found error.
2) The seond problem is I can find the /usr/bin/php which is used in the httpd.conf (I searched in the / of the router and also on the USB Key). I can't find it. And PHP5 is well installed :
php5 - 5.2.6-2 -
php5-mod-mysql - 5.2.6-2 -
php5-mod-session - 5.2.6-2 -
php5-mod-xml - 5.2.6-2 -


Can somebody tell me what to do to give the correct php in the httpd.conf ? And how to keep displayed my index file without going to the  http://192.168.1.1:81/cgi-bin/luci

Sincerely thanks and have a nice day.

Miguipda ;-)

Hi,

Goal: Php4 with busybox httpd server (kamikaze 8.09 + x-wrt on a WL500gp v2)

I have tried the following:

- installed php4 (on usb disk) (using the packages from http://downloads.openwrt.org/kamikaze/8 … /packages)
- more specifically I have now installed the following packages (php4, php4-cli, php4-fastcgi, php4-curl)
- added a "*.php:/mnt/Optware/usr/bin/php" to httpd.conf (at the bottom of this file)
- created file phpinfo.php
- configured "cgi.force_redirect = 0 and cgi.redirect_status_env ="yes";" in php.ini
- php-commands work - OK (requesting phpinfo.php in the browser displays a lot of phpinfo)

However: I cannot get the webserver to output a file that will be recognized as a html page. How do get the php output to be recognized as html?

I have seen this question in one post before but could not see an answer.

/Filifjonkan

Firmware               OpenWrt Kamikaze - With X-Wrt Extensions 8.09
Kernel          Linux 2.4.35.4 #3 Tue May 12 09:24:48 CDT 2009
MAC                  00:XXXXXXX
Device         ASUS WL-500g Premium V2
Board         Broadcom BCM5354 chip rev 3

(Last edited by filifjonkan on 29 Dec 2009, 05:47)

filifjonkan wrote:

Hi,

Goal: Php4 with busybox httpd server (kamikaze 8.09 + x-wrt on a WL500gp v2)

I have tried the following:

- installed php4 (on usb disk) (using the packages from http://downloads.openwrt.org/kamikaze/8 … /packages)
- more specifically I have now installed the following packages (php4, php4-cli, php4-fastcgi, php4-curl)
- added a "*.php:/mnt/Optware/usr/bin/php" to httpd.conf (at the bottom of this file)
- created file phpinfo.php
- configured "cgi.force_redirect = 0 and cgi.redirect_status_env ="yes";" in php.ini
- php-commands work - OK (requesting phpinfo.php in the browser displays a lot of phpinfo)

However: I cannot get the webserver to output a file that will be recognized as a html page. How do get the php output to be recognized as html?

I have seen this question in one post before but could not see an answer.

/Filifjonkan

Firmware               OpenWrt Kamikaze - With X-Wrt Extensions 8.09
Kernel          Linux 2.4.35.4 #3 Tue May 12 09:24:48 CDT 2009
MAC                  00:XXXXXXX
Device         ASUS WL-500g Premium V2
Board         Broadcom BCM5354 chip rev 3

https://forum.openwrt.org/viewtopic.php?id=18889 check this post

OK,
I do not know what made the difference. I uninstalled everything, and installed again. Suddenly html worked in the browser. Maybe I am too stupid to understand, but I could not find any new info in the referred post. Anyway, it made me do everything once again, and now it works! Thank you!!!! (could it be the exact packages I installed??? they where not the same??? this time I only installed php4-cgi)

Now I am going to start working with php seriously

/Per

(Last edited by filifjonkan on 31 Dec 2009, 20:47)

yes, it had to do with the packages smile

Hi Osmosis
                   Please furnish STEP BY STEP how to download and install php4/5-cgi in Busybox.
However the link following is not working "https://forum.openwrt.org/index.php?login=1".
NOTE:
If i need to "make" i should use "arm-9tdmi-linux-gnu-gcc" as "CC".

Hi

Where can I find link to download php for busybox ?

Please help

Thanks

The discussion might have continued from here.