Home arrow foXServe arrow Enable CGI on foXServe and Remote I/O control with HTML and CGI
Enable CGI on foXServe and Remote I/O control with HTML and CGI PDF Print E-mail
This article illustrates how to write a cgi in C to generate a web page to control remotely each I/O line available on J6 and J7 extension sockets.
On foXServe I/O control can also be performed from PHP scripting.

The original article on ACME website http://www.acmesystems.it/?id=212 demostrate the use of BOA for CGI execution, in this page we will enable CGI on apache.

Enable CGI execution under APACHE WEBSERVER

Connect to your foXServe shell and create the directory cgi-bin
mkdir -p /mnt/flash/root/cgi-bin
edit /etc/httpd.conf

Find this line.

#ScriptAlias /cgi-bin/ @@ServerRoot@@/cgi-bin/

Change it to read as follows, but of course substitute the full unix path to the directory containing your scripts if it is different than what is shown below.
ScriptAlias /cgi-bin/ /mnt/flash/root/cgi-bin
Then, track down this line:
#AddHandler cgi-script .cgi
and make it read as follows (uncomment it):
AddHandler cgi-script .cgi

Next, append on the end of the file a per directory directive

<Directory /mnt/flash/root/cgi-bin>
  AllowOverride None
  Options None
</Directory>


Now download the cgi executable iocontrol.cgi and upload it using FTP ot scp inside the newly cretaed cgi-bin folder.
Don't forget to give the right permissions to the file with the command:

chmod 0777 /mnt/flash/root/iocontrol.cgi

point your browser to http://<ip of your foxserve>/cgi-bin/iocontrol.cgi and an output like this should appear:



You can also compile the C source code iocontrol.c with Webcompiler or inside the SDK:
o How to compile a C program with WebCompiler
o How to compile a C application
* Rename the executable file in iocontrol.cgi and save it in the cgi folder
* Access to the cgi web page from this URL:
o http://<your ip>/cgi-bin/iocontrol.cgi

The web page shown different I/O sections:

* Lines A0-A7 (configurable as input or output)
* Lines B0-B7 (configurable as input or output)
* Lines IOG8-IOG15 (configurable as a block of all input or all output)
* Lines IOG16-IOG23 (configurable as a block of all input or all output)
* Lines IOG0 and IOG24 (configurable as input or output)
* Lines IG1-IG7 and IG25-IG31 (fixed as input)
* Lines OG1-OG7 and OG25-OG31 (fixed as output)

For each block there is the line name, the physical pin on J6 or J7 and some buttons to set (3.3 volt) or clear (0 volt) the line and configure it as input or output when applicable.

On every refresh of this page the state (HI or LO) of each input line is updated.

 
< Prev   Next >

Easy Guardian

Server / Network  monitoring
appliance devoted website
easy guardian
http://www.easyguardian.com

FoxBox dedicated website

Login Form






Lost Password?
No account yet? Register

Partner

Artera propone servizi di registrazione domini internet, hosting professionale, housing e server dedicati

Robotoons Publishing

 

 


ABOUT SSL CERTIFICATES



Product description Price Code Qt.y
SMS FoxBox

SMS FoxBox

The new FoxBox G20 is a Linux microserver that provides innovative functionalities for MMS and SMS management and integrates easy guardian for monitoring network devices.

830 EUR FOXBOXG20

2009 KDEV di Davide Cantaluppi, P.IVA 02984320131
KDEV SMS è un servizio di KDEV System Development    FoxBox SMS-MMS Hardware Gateway - FoxBox appliance
SMS KDEV sms inbound SMS KDEV ricevi ed elabora tuoi SMS e invia SMS con altissime prestazioni

spacer.png, 0 kB
spacer.png, 0 kB