Zero logo

Run as a service

After installing module ZeroXV_uniservice_x_x_x, folder UniServerZ contains 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: Admin privileges are required. When prompted, click Yes to allow changes to your computer.

Install module (plugin)

Install The Uniform Server service plugin as follows:

  1. Download ZeroXV_uniservice_x_x_x.exe module (plugin).
  2. Copy ZeroXV_uniservice_x_x_x.exe module (plugin) to folder UniServerZ
  3. Double-click on the downloaded module; this starts the extraction process.
  4. If requested, allow overwriting of existing files.
  5. If you wish to save space, delete file ZeroXV_uniservice_x_x_x.exe
  • Folder UniServerZ now contains two new files:
       ◦ UniService.exe - Service Application
       ◦ ZeroXV_uniservice_x_x_x_read_me.txt - Contains additional information

Warning

The Uniform Server Service application and UniController are independent applications; this means there is no interaction between the two. Use only one or the 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 are that 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 Install service button (A). Run it by clicking Run service button (B).
       ◦ To install MySQL service, click Install service button (C). Run it by clicking Run service button (D).
  • 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 Stop service button (B).
         Uninstall it by clicking Uninstall service button (A).
       ◦ To stop MySQL service, click Stop service button (D).
         Uninstall it by clicking Uninstall service 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. Check configuration files exist;
  2. Create back-up folder and copy files;
  3. Check all back-up files exist;
  4. Replace variables with absolute paths;
  5. Open a command window;
  6. Install Apache service;
  7. Perform Apache configuration test;
  8. Uninstall Apache service (close window when done);
  9. Restore original files from back-up;
  10. Delete back-up files and folder.

Closing above command window returns to the Uniform Server Service utility.

Errors reported must be corrected before the service can be installed and started from the Uniform Server Service utility.

Operation overview

The following provides an operation overview of the service application.

Install service

Apache

  • Clicking Install service button (A) initiates a backup of the following configuration files:
       ◦ httpd.conf
       ◦ 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
       ◦ php_production.ini - Selected configuration file
       ◦ phpxx.conf - Selected PHP version
       ◦ php-cli.ini
  • 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 line is executed, installing the Apache service:
       ◦ C:\UniServerZ\core\apache2\bin\httpd_z.exe -k install -n "us_apache_1"
  • Button text toggles state:
       ◦ Install service button (A): Text Install service changes to Uninstall service.
  • Indicator toggles state:
       ◦ Changes from red (not installed as service) to green (installed as service).
  • Run service button (B): Run service is enabled.

MySQL

  • Clicking Install service button (C) initiates the following:
  • Following command line is executed, installing the MySQL service:
       ◦ C:\UniServerZ\core\mysql\bin\bin\mysqld_z.exe --install "us_mysql_1" --defaults-file=C:/UniServerZ/core/mysql/my.ini
  • Button text toggles state:
       ◦ Install service button (C): Text Install service changes to Uninstall service.
  • Indicator toggles state:
       ◦ Changes from red (not installed as service) to green (installed as service).
  • Run service button (D): Run service is enabled.

Run service

Apache

  • Clicking Run service button (B) runs the service by executing the following command line:
       ◦ C:\UniServerZ\core\apache2\bin\httpd_z.exe -k start -n "us_apache_1"
  • Button text toggles state:
       ◦ Run service button (B): Text Run service changes to Stop service.
  • Indicator toggles state:
       ◦ Changes from red (service not running) to green (service running).
  • Uninstall service button (A): Uninstall service is disabled.

MySQL

  • Clicking Run service button (D) runs the service by executing the following command line:
       ◦ sc.exe start "us_mysql_1"
  • Button text toggles state:
       ◦ Run service button (D): Text Run service changes to Stop service.
  • Indicator toggles state:
       ◦ Changes from red (service not running) to green (service running).
  • Uninstall service button (C): Uninstall service is disabled.

Stop service

Apache

  • Clicking Stop service button (B) stops the service by executing the following command line:
       ◦ C:\UniServerZ\core\apache2\bin\httpd_z.exe -k stop -n "us_apache_1"
  • Button text toggles state:
       ◦ Stop service button (B): Text Stop service changes to Run service.
  • Indicator toggles state:
       ◦ Changes from green (service running) to red (service not running).
  • Uninstall service button (A): Uninstall service is enabled.

MySQL

  • Clicking Stop service button (D) stops the service by executing the following command line:
       ◦ sc.exe stop "us_mysql_1"
  • Button text toggles state:
       ◦ Stop service button (D): Text Stop service changes to Run service.
  • Indicator toggles state:
       ◦ Changes from green (service running) to red (service not running).
  • Uninstall service button (C): Uninstall service is enabled.

Uninstall service

Apache

  • Clicking Uninstall service button (A) uninstalls the Apache service by executing the following command line:
       ◦ C:\UniServerZ\core\apache2\bin\httpd_z.exe -k uninstall -n "us_apache_1"
  • Button text toggles state:
       ◦ Uninstall service button (A): Text Uninstall service changes to Install service.
  • Indicator toggles state:
       ◦ Changes from green (installed as service) to red (not installed as service).
  • Run service button (B): Run service is disabled.
  • Following configuration files are restored to their original location:
       ◦ httpd.conf
       ◦ 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
       ◦ php_production.ini - Selected configuration file
       ◦ phpxx.conf - Selected PHP version
       ◦ php-cli.ini
  • Backup folder C:\UniServerZ\core\service_back is deleted.
  • Note: Original configuration files use relative paths. Servers are now portable and can be moved.

MySQL

  • Clicking Uninstall service button (C) uninstalls the MySQL service by executing the following command line:
       ◦ C:\UniServerZ\core\mysql\bin\bin\mysqld_z.exe --remove "us_mysql_1"
  • Button text toggles state:
       ◦ Uninstall service button (C): Text Uninstall service changes to Install service.
  • Indicator toggles state:
       ◦ Changes from green (installed as service) to red (not installed as service).
  • Run service button (D): Run service is disabled.

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--