1. Summary
  2. Report Spam
  3. Create account
  4. Log in

5.0-Nano: UniTray

From mpgcan

Jump to: navigation, search




Uniform Server 5.0-Nano. PHP 5.2.10
Uniform Server 5.1-Nano. PHP 5.3.0

Uniform Server 5.0-Nano UniTray

Aestan Tray was developed by Onno Broekmans and has stood the test of time. There are alternatives but none have the flexibility and controllability as Aestan Tray. It is extremely malleable hence has been integrated into Uniform Server to produce UniTray.

Should you not like UniTray’s offerings edit the configuration file to provide the solution you want? Note the configuration file is dynamically updated hence certain items should not be changed these are covered on this page after a basic introduction.

UniTray - Quick start servers

For connivance I have reproduced this section from the introduction page.

There are two menus corresponding to the left and right mouse buttons.

The left menu controls servers as a standard program while the right menu controls the servers as a service.

Ergonomics are such that the order of complexity is from top to bottom with commonality reproduced in both menus for connivance.

Run servers as a standard program
Quick Start guide
Run servers as a service


Run Servers as standard Program

  • Start UniTray: In folder UniServer double click on Start.exe tray icon created.
  • L3) Check servers are runnable: Left or Right click tray icon > click Server Status.
    All ports must be free to use.
  • L1) Start Uniform Server. Left click tray icon > click Start UniServer
  • L2) Stop Uniform Server. Left click tray icon > click Stop UniServer
  • L4) Close UniTray. Left or Right click tray icon > click Exit

Run Servers as a Service

  • Start UniTray: In folder UniServer double click on Start.exe tray icon created.
  • R3) Check servers are runnable: Left or Right click tray icon > click Server Status.
    All ports must be free to use.
  • R1) Start Uniform Server. Right click tray icon > click Install and Run all Services
  • R2) Stop Uniform Server. Right click tray icon > click Stop and Remove All Services
  • R4) Close UniTray. Left or Right click tray icon > click Exit

Note: Double click on tray icon to open Apanel in default browser.


In reality server control makes no destitution between running as a standard program or service you are free to mix the two (even from a USB memory stick).

Server control will attempt to perform the action requested, generally if the request is invalid it gets silently ignored (trying to run the servers twice) or a warning message is displayed (Perl shebang update with no Perl plugin).

This interlocking action attempts to prevent inadvertent server failure.

UniTray Help

Detailed information is provided for each menu option in file help.html.

To access this file either

  • Double click on file UniServer\help.bat


  • From UniTray Left click tray icon > click Server Documentation
  • Page displayed, click link help.html


Server Status - Diagnostics

Server Status provides a mixed bag of information:

  • Before starting servers checks to see if ports are in use which would prevent the servers starting
  • Displays what ports servers are configured for.
  • Displays what servers are running and in what mode (standard program or service)
  • With servers running displays IP address as seen from the Internet.
  • Checks servers are accessible from the Internet, uses the above IP address



UniTrays configuration file allows you to delete, add or modify menu items.

Location: UniServer\unicon\tray_menu\UniTray1.ini

Note: If you have moved the servers, the ini file will be renumbered accordingly.

Scanning down the file you will notice it is split into sections left, right and common menus.

Suppose you want to start the servers without displaying the index page.

Locate the following line (Note: Line split to prevent breaking Wiki page ):

Type: item; Caption: "Start UniServer (Apache MySQL)";
Action: shellexecute; FileName: "%PHP%\php.exe";
Parameters: " -n %ServerConMain%\start_servers.php 7";
ShowCmd: hidden; Glyph: 9

Replace with this:

Type: item; Caption: "Start UniServer (Apache MySQL)";
Action: shellexecute; FileName: "%PHP%\php.exe";
Parameters: " -n %ServerConMain%\start_servers.php 3";
ShowCmd: hidden; Glyph: 9

Difference between the two lines is the parameter passed to the script start_servers.php

Parameters are binary coded ( see Script Parameters) and override defaults changing from 7 to 3 starts only Apache and MySQL servers.

The corresponding parameter for stop servers should be changed accordingly.


Start and Stop UniTray

With all those start stop files UniTray control looks complex in reality they are slight variations of performing the same thing. If you follow a control path it ends in a single function. This applies not only to UniTray it is the heart of UniServer’s control architecture.

It’s probably worth following one of these paths for example UniTray’s stop.



All batch files are nothing more than a user interface to run a PHP CLI script.

UniServer\unicon\tray_menu\Stop_UniTray.bat containes the following line:

..\..\usr\local\php\php-win.exe -n  stop_unitray.php

This line runs PHP interpreter which in turn runs the script stop_unitray.php

It uses relative paths for portability



All PHP scripts run from a batch file perform as the first task a server move check.

If servers have moved they are reconfigured accordingly, the script then continues.

UniServer\unicon\tray_menu\stop_unitray.php containes the following lines:

run_location_tracker(); // Have servers moved update configuration accordingly
stop_unitray();         // Run stop function



All server control functions are located in file:


After removing irrelevant information the function stop_unitray() looks like this:

  global $us_con_tray_menu;                           // Location of UniTray
  $UniTray_exe = get_unitray_exe();                   // get program name  
  $UniTray_id = get_unitray_id();                     // get id name  
  $cmd1 = "start ".$us_con_tray_menu."/".$UniTray_exe; // path to executable
  $cmd2 = "  -quit -id=".$UniTray_id;                  // set ID 
  $cmd =$cmd1.$cmd2;                                   // Unitay does not like / hence
  $cmd =  preg_replace('/\//','\\', $cmd);             // Replace / with \

  exec($cmd,$dummy,$return);                           // run command 

Real point of showing this function, although it is the last one to be called from our script the function itself assumes things have changed. The server is dynamic UniTray exe may have been renamed likewise the ID in the configuration file may have been updated. Hence these are read from source using the get functions.


Variables not to be change

I mentioned there are several variables in UniTray’s configuration file you should not these are dynamically configured. I have listed these below:

ID=UniTrayController1Digit incremented when server moved
TrayIcon=tray_image_1.datDigit incremented when server moved
USRoot; Value: "%top%";Dynamic variable passed UniTray start (top) Type: commandline; Name: top; ParamName: "ustop"



UniTray is very versatile and easy to use don’t worry about any of the techno babble just use it.

Next page covers security and passwords.


Image:uc_small_logo.gif MPG (Ric)

Personal tools