Phpsysinfo Apache Chroot

1 minute read

Published:

https://web.archive.org/web/20041205014843/http://phpsysinfo.sourceforge.net/

phpSysinfo is a PHP script that displays information about the host being accessed. It will displays things like Uptime, CPU, Memory, SCSI, IDE, PCI, Ethernet, Floppy, and Video Information.

https://web.archive.org/web/20041205014843/http://blog.megalomanic.net/phpGiggle?http://www.openbsd.org

The problem is, it does not work out of the box in a chrooted enviornment such as the Apache webserver in OpenBSD’s default configuration. This is because phpSysInfo is trying to access things outside of the chroot, and fails.

By using the following instructions you will be able to have a working phpSysInfo installation in a chrooted enviornment. It’s a fairly simple procedure and should work for all systems where phpSysInfo already works.

  1. Download and install phpSysInfo like normal.

cd /var/www/htdocs/ wget http://heanet.dl.sourceforge.net/sourceforge/phpsysinfo/phpsysinfo-2.3.tar.gz tar zxvf phpsysinfo-2.3.tar.gz mv phpsysinfo-dev/ phpSysInfo/ cd phpSysInfo/ mv config.php.new config.php rm COPYING rm ChangeLog rm README

  1. At this point you should be able to view the “broken” phpSysInfo page. Example.

https://web.archive.org/web/20041205014843/http://megalomanic.net/phpSysInfo/index.php

  1. Setup a crontab entry with the following single line (may very):
            • cd /var/www/htdocs/phpSysInfo && /usr/local/bin/php ./index.php > ./index.html 2> /dev/null
  2. Wait a minute then test it using the new index.html page. Example.

https://web.archive.org/web/20041205014843/http://www.megalomanic.net/phpSysInfo/index.html

  1. Thats it!

So how’s it work?

The cron job is the key. It simulates someone accessing the index.php file and stores the result in the index.html file every minute. This works because cron runs outside the Apache chroot where phpSysInfo is designed to be. By generating a static index and placing it on the webserver the user gets all the statistics of phpSysInfo (although about a minute behind).

What doesn’t work?

Just the style templates. These feed off the original php design and don’t work under the static configuration. The quick fix is to edit config.php to use your favorite style by default. The longer, really unecessary solution is generate the html for every style and use a php index to pick the static page associated with the style. Not too difficult, maybe I’ll write it later. :-P

Direct questions, comments, etc to [email protected].

As an Amazon Associate I earn from qualifying purchases.