R-pi

404

Add custom error pages to your pi. Six different pages are included, but you can easily add your own.
(NOTE: Fixed a typo in the README. Wrong directory was listed.)
Pages included are;

300 – Multiple Choices
401 – Unauthorized
403 – Forbidden
404 – Not Found
500 – Server Error
503 – Out Of Resources


A simple script to show the correct GPIO pinouts depending on the board version of your pi.
Don’t forget to chmod +x the file. ./pins.sh to run.

Code is broken because of a change in bash since it was written. I’ll get around to fixing it sooner or later.


04/07/14 – UPDATED TO USE JQPLOT INSTEAD OF phpChart_Lite
Additional edits/additions. Changes and instruction in README inside .rar.

Here the code for the Raspberry pi (www.raspberrypi.org) status page I cooked up. It was mostly a quick and dirty hack to test Apache/php on it, but some of the users in IRC (freenode #raspberrypi) wanted copies. Everything you need to know should be in the README.
IMPORTANT: The current version of phpChart_Lite ONLY supports line charts, the meter class has been removed. I will be looking for a replacement and update the code as soon as I find one.

(Updated to support Model A boards)
Raspberry pi status page

14 Responses to R-pi

  1. John says:

    Hello
    I copied your files into my Apache 2 dir, /var/www/html/CPUStatus

    I attempted to follow your instructions with visudo and added
    www-data ALL=(ALL) NOPASSWD: ALL
    at the bottom.

    When i browse to index.php I see a background image but nothing else.
    There is probably some permission or something I have missed. Can you point me in the right direction?

    The page looks really nifty.

    John

  2. John says:

    I’ve made some progress, i was missing the chart.
    I put it in /var/www/html/CPUStatus/phpChart_Lite

    I get the following error now

    Warning: require_once(/var/www//phpChart_Lite//conf.php): failed to open stream: No such file or directory in /var/www/html/CPUStatus/phpChart_Lite/server/cls_conf.php(1) : eval()’d code on line 1

    Fatal error: require_once(): Failed opening required ‘/var/www//phpChart_Lite//conf.php’ (include_path=’.:/usr/share/php:/usr/share/pear’) in /var/www/html/CPUStatus/phpChart_Lite/server/cls_conf.php(1) : eval()’d code on line 1

  3. atouk says:

    It looks like you have a problem with the folder structure of /www. Make sure that phpChartLite is installed under /www.

    /www
    index.php
    |
    /images
    /php_ChartLite
    |
    config.php
    phpChart.php
    ...

  4. John says:

    Thanks, I’m reluctant to put the whole thing at www as I have other stuff there I don’t want to break, therefore I put it all in the sub-directory CPUStatus. Does phpChart_Lite have to be at the www level, even if index.php is in CPUStatus?

    My struct
    /var/www/CPUStatus
    index.php
    phpChart_Lite
    |
    — conf.php
    etc…

    So no luck yet. I’ll experiment more tomorrow.

    Thanks for responding

    John

  5. atouk says:

    As long as the relative paths under index.php are the same, you should be OK.

  6. John says:

    Thanks Atouk

    I started from scratch and unzipped phpChart_Lite and your files. Now I get the page come up.

    Unfortunately the temperature chart is complaining that the lite version does not support the appropriate renderer

    “Renderers used are not available in phpChart Lite.”

    I have replaced the js file as you suggest.

    Any ideas?

    John

  7. atouk says:

    I’ll have to check on that error. It’s possible that the meter renderer was removed from the lite version in the latest release.

    UPDATE: The current version of lite ONLY contains line type charts. I’ll be looking for a replacement.

  8. John says:

    No worries thanks.
    For now I just print out the temp and removed the chart.
    John

  9. Paul says:

    Hai,

    Cool script but just one change I would sincerely advice:
    Use visudo and add:

    www-data ALL=NOPASSWD:/opt/vc/bin/vcgencmd

    This allows only ‘vcgencmd’ as sudo and not ALL commands that would be an open door..

    Chrs p.

  10. Göran Sandström says:

    No matter how hard I try (reinstalled multiple times etc) I still get:

    Warning: require_once(/var/www//phpChart_Lite//conf.php): failed to open stream: No such file or directory in /var/www/pistatus/phpChart_Lite/server/cls_conf.php(1) : eval()'d code on line 1

    Fatal error: require_once(): Failed opening required '/var/www//phpChart_Lite//conf.php' (include_path='.:/usr/share/php:/usr/share/pear') in /var/www/pistatus/phpChart_Lite/server/cls_conf.php(1) : eval()'d code on line 1

  11. atouk says:

    phpChart lite has changed since I created the page. The meter has been removed and is only available in the full version.

    I will find a replacement, or redo the page as soon as I get some free time.

  12. Greg says:

    phpChart_Lite is based on the freely available jqplot available for free from http://www.jqplot.com/ I have tested it with version 1.0.8r1250 and it works well. Replace the phpChart_Lite code with the following

    $(document).ready(function(){
    s1 = []

    plot1 = $.jqplot(‘pitemp’,[s1],{
    seriesDefaults: {
    renderer: $.jqplot.MeterGaugeRenderer,
    rendererOptions: {
    label: ”,
    ticks:[10, 20, 30, 40, 50, 60, 70, 80, 90],
    intervals:[35,70,85],
    intervalColors:[‘#66cc66’, ‘#E7E658’, ‘#ff0000’]
    }
    }
    });
    });

    Add the lines below just above

    And for transparent backgrounds add the following to the section
    .jqplot-series-shadowCanvas {
    background-color: #B0C4DE;
    }

  13. Greg says:

    For some reason all of the HTML code I entered was filtered out. I’m not sure how to get that to you.

  14. Jaa5 says:

    I don’t seem to have all files? not in zip file? Specifically in this directory phpChart_Lite/ i have no conf files or PHP files? is it just me?

Leave a Reply

Your email address will not be published. Required fields are marked *

This blog is kept spam free by WP-SpamFree.