# OI Web Server
OI Embedded ships with a built-in web server and PHP script support.
OI Windows does not provide a web server.
# Web Server
OI's embedded web server is Lighttpd without SSL support.
# PHP support
OI's supported PHP version is PHP 5.6.26 with extensions:
To avoid timezone error the following line of code has to be used in php script:
or by using following require all needed default settings will be set:
init_defaults.php is located in '/var/oi/www/php_inc'
# PHP script locations accessible by http
|Touch screen http url||File system directory||Permission||Description|
|http://touch_screen_IP/||/tmp/www/||read/write||Symlink pointing to storage directory on data card.|
|http://touch_screen_IP/app/||/tmp/app/httpscripts/||read/write||Contains all files which are part of the current oi application from app's directory 'appname___httpscripts'. |
NOTE: this directory is completely deleted at application start and then whole 'appname___httpscripts' directory is copied here.
|http://touch_screen_IP/fw/php/||/var/oi/www/php/||read only||Contains php scripts which are part of the firmware. Examples: http://touch_screen_IP/fw/php/examples|
# Internal PHP scripts location
File system directory
|File system directory||Permission||Description|
|/var/oi/www/php_cli||read only||Contains internal php scripts which are part of the firmware. These scripts are intended to be run from command line.|
|/var/oi/www/php_inc||read only||Contains internal php scripts which are part of the firmware. These scripts are intended to be included.|
# Using the Web Server
OI can provide webpages for the terminal as well as specific pages for the application.
# OI Terminal Webpages
Webpages for the terminal itself can be loaded on the data card under the 'www' directory. To test, place an index.html file in this directory:
<html> <body> HELLO </body> </html>
Then you can browse to http://touch_screen_IP/ and load the page.
# Application Specific Webpages
You can include webpages specifically for your application by including them in your 'appname___httpscripts' directory.
When the screen boots, or when you Select Application, the contents of the httpscripts directory is copied to the /var/volatile/tmp/app/httpscripts folder. You can then view these webpages at http://touch_screen_IP/app/
The httpscripts directory is created whenever an HTTP Script component is created. You do not need to create the component if you are just using the directory to serve webpages for your application.
If you do not use the component, you simply need to create the directory and the contents will be copied.
You can provide PHP files as scripts for your application. Within your PHP scripts you can communicate with OI's XML-RPC server to fetch tag data, or interact with the SQLite database for your application to provide advanced data interaction functionality.
Serving webpages does consume some processing capacity. Be mindful that server intensive scripts could affect runtime performance of the screen.