Zero logo

Run as a service

After installing module ZeroXI_uniservice_2_0_1 folder UniServerZ contains a file UniService.exe running this file opens the Uniform Server Service application. This application allows you to install and run The Uniform Server as a service.

NOTE: For Win7 and Win8, admin privileges are required. When prompted click yes allow changes to this computer.

Install module (plugin)

Install The Uniform Server service plugin as follows:

  1. Download ZeroXI_uniservice_1_0_0.exe module (plugin)
  2. Copy ZeroXI_uniservice_2_0_1.exe module (plugin) to folder UniServerZ
  3. Double click on the downloaded module
  4. This starts the extraction process
  5. If requested allow overwriting of existing files.
  6. If you wish to save space delete file ZeroXI_uniservice_2_0_1.exe
  • Folder UniServerZ now contains two new files:
    • UniService.exe - Service Application
    • ZeroXI_unservice_read_me.txt - Contains additional informs

Warning

The Uniform Server Service application and UniController are independent applications this means there is no interaction between the two. Use only one or other to control the servers as follows:

  • Very important.
    • Ensure servers have been configured correctly and correct operation has been confirmed by running as a standard application using Unicontroller.
  • Before installing and running servers as a service.
    • Ensure servers are stopped and UniController is closed.
  • After installing and running servers as a service do not use UniController to control servers.
    • Before using UniController stop and uninstall services.

Uniform Server Service application

When using this application, you install the servers as services; it adds data to your operating system’s registry. The advantages of running as a service, when you restart your PC, servers’ will automatically re-start. You can install and run services from a USB memory stick however, you must remember to stop and uninstall services before removing your USB stick.

Buttons (A,B) and (C,D) provide independent control of Apache and MySQL servers respectively.

  • Install and Run services
    • To install Apache service click button A). Run service by clicking button B).
    • To install MySQL service click button C). Run service by clicking button C).
    Buttons A and C toggle to display uninstall. Indicators change from red to green when services have been installed and are running.
Note: Servers now use absolute paths and are no longer portable.
  • Stop and Uninstall services
    • To stop Apache service click button B). Uninstall service click button A).
    • To stop MySQL service click button D). Uninstall service click button C).
    This stops and uninstalls both servers. Service application returns to initial state as shown at right.
Note: Servers are now portable and can be moved.
Start as service

Apache service test

Errors in Apache configuration files will prevent Apache running as a service. After making changes to configuration files ensure the servers function correctly when run as a standard program. After testing stop servers, close UniController and start UniService. Click Apache service test button E).

Apache service test performs the following:

  • 1) Open a command window
  • 2) Check configuration files exist
  • 3) Create back-up folder and copy files
  • 4) Check all back-up files exist
  • 5) Replace variables with absolute paths.
  • 6) Install Apache service
  • 7) Performs Apache configuration test
  • 8) Uninstall Apache service.
  • 9) Restore original files from back-up.
  • 10) Delete back-up files and folder.

Closing above command window returns to the Service Utility UniService.

Errors reported must be corrected before the service can be installed and started from the UniServer Service Utility.

Operation overview

The following provides an operation overview of the service application:

Install service

  • Clicking buttons A or C initiates a backup of the following configuration files:
    • httpd-autoindex.conf
    • httpd-dav.conf
    • httpd-manual.conf
    • httpd-multilang-errordoc.conf
    • httpd-sni.conf
    • httpd-ssl.conf
    • httpd-userdir.conf
    • httpd-vhosts.conf
    • httpd.conf
    • php-cli.ini
    • php_production.ini - Selected configuration file
  • A backup folder C:\UniServerZ\core\service_back is created if it does not exist and the above configuration files copied to it.
  • Relative paths within original configuration files are converted to absolute paths.
    • Note: Because servers now use absolute paths they are no longer portable.
  • Following command lines are executed installing the appropriate service:
    • Button A: C:\UniServerZ\core\apache2\bin\httpd_z.exe -k install -n "us_apache_1"
    • Button C: C:\UniServerZ\core\mysql\bin\bin\mysqld_z.exe --install "us_mysql_1" --defaults-file=C:/UniServerZ/core/mysql/my.ini
  • Button text toggle state:
    • Button A: Text Install service changes to UnInstall service.
    • Button C: Text Install service changes to UnInstall service.
  • Indicators toggle state as appropriate:
    • Changes from red (not installed as service) to green (installed as service).
  • Buttons B and D Run service are enabled as appropriate.

Run service

  • Clicking enabled buttons B or D runs the service by executing the following command line:
    • Button B: C:\UniServerZ\core\apache2\bin\httpd_z.exe -k start -n "us_apache_1"
    • Button D: sc.exe start "us_mysql_1"
  • Button text toggle state:
    • Button B: Text Run service changes to Stop service.
    • Button D: Text Run service changes to Stop service.
  • Indicators toggle state as appropriate:
    • Changes from red (service not running) to green (service running).
  • Buttons A and C UnInstall service are disabled as appropriate.

Stop service

  • Clicking enabled buttons B or D stop the service by executing the following command line:
    • Button B: C:\UniServerZ\core\apache2\bin\httpd_z.exe -k stop -n "us_apache_1"
    • Button D: sc.exe stop "us_mysql_1"
  • Button text toggle state:
    • Button B: Text Stop service changes to Run service.
    • Button D: Text Stop service changes to Run service.
  • Indicators toggle state as appropriate:
    • Changes from green (service running) to red (service not running).
  • Buttons A and C UnInstall service are enabled as appropriate.

Uninstall service

  • Clicking buttons A or C following command lines are executed uninstalling the appropriate service:
    • Button A: C:\UniServerZ\core\apache2\bin\httpd_z.exe -k uninstall -n "us_apache_1"
    • Button C: C:\UniServerZ\core\mysql\bin\bin\mysqld_z.exe --remove "us_mysql_1"
  • Button text toggle state:
    • Button A: Text UnInstall service changes to Install service.
    • Button C: Text UnInstall service changes to Install service.
  • Indicators toggle state as appropriate:
    • Changes from green (installed as service) to red (not installed as service).
  • Buttons B and D Run service are disabled as appropriate.
  • Last uninstall button A or C initiates a restore of the following configuration files:
    • httpd-autoindex.conf
    • httpd-dav.conf
    • httpd-manual.conf
    • httpd-multilang-errordoc.conf
    • httpd-sni.conf
    • httpd-ssl.conf
    • httpd-userdir.conf
    • httpd-vhosts.conf
    • httpd.conf
    • php-cli.ini
    • php_production.ini - Selected configuration file
  • Above configuration files are copied to their original location. Backup folder C:\UniServerZ\core\service_back is deleted.
  • Note: Original configuration files use relative paths. Servers are now portable and can be moved.

Change service names

Service names are changeable by editing file C:\UniServerZ\home\us_config\us_config.ini

  • Locate section [SERVICE]
  • Change the following lines as appropriate:
    • MySQLServiceName=us_mysql
    • ApacheServiceName=us_apache
    Note: The AppNumber is appended to the service name to give its full name for example us_mysql_1

--oOo--