foXServe 1.3
Smooth. Secure. Solid State. Silent. eXtraSmall.
@ KDEV 2007 Some Rights Reserved
Enable CGI on foXServe and Remote I/O control with HTML and CGI
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>Now download the cgi executable iocontrol.cgi and upload it using FTP ot scp inside the newly cretaed cgi-bin folder.
AllowOverride None
Options None
</Directory>
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.
SMS MMS FoxBox the appliance based on foxserve for messaging management |
foXServe is Developed by KDEV a Davide Cantaluppi company and running on ACME SYSTEMS srl Hardware.
@ KDEV 2007 Some Rights Reserved
foXServe firmware is free
Download it now! |
LICENSES
Apache/1.3.37 Server
Copyright 2007 Kdev of Davide Cantaluppi Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
PHP 5.0.5
"This product includes PHP software, freely available from <http://www.php.net/software/>"
MOD_DAV
This product includes software developed by Greg Stein <gstein@lyra.org> for use in the mod_dav module for Apache (http://www.webdav.org/mod_dav/).