0

i want to start Apache and MySQL automatically by command line in uniserver zero XIV

here official site propose that you start it with the following command (And works!):

UniController.exe start_both
UniController.exe stop_both

It can also be done manually by GUI (And works!):

enter image description here

problem:

curiously the above action modifies the file C:\UniServerZ\home\us_config\us_config.ini from false to true

RunAtPcStartUpEnabled=true
RunApacheAtStartUp=true
RunMysqlAtStartUp=true

But if I do the modification directly in the file us_config.ini (without opening the application), and change these values from false to true, when I restart the PC, apache + mysql does not start, so the above action must do something else

Also here official site propose to install and run as a service (And it does not work!):

C:\UniServerZ\core\apache2\bin\httpd_z.exe -k install -n "us_apache_1"
C:\UniServerZ\core\mysql\bin\bin\mysqld_z.exe --install "us_mysql_1" --defaults-file=C:/UniServerZ/core/mysql/my.ini
C:\UniServerZ\core\apache2\bin\httpd_z.exe -k start -n "us_apache_1"
sc.exe start "us_mysql_1"

enter image description here

but these commands are incomplete and contain source errors

What is the correct way to start with the PC apache + mysql in UniServer Zero XIV (by cmd command line or modifying .ini file)? thanks

2 Answers 2

0

There's a way you can do this with a graphical user interface without using the command line or registry tricks, and that's to setup a scheduled task.

  1. Open Task Scheduler

    To open Task Scheduler there are multiple methods

    • Windows Key + X then click Computer Management
    • Using the start menu, search for Scheduled Tasks or Computer Management
    • Open Administrative Tools under the Start Menu or Control Panel to find Task Scheduler or Computer Management
  2. Click Create Basic Task on the Actions menu on the right hand side click create basic task in task scheduler

  3. Choose a name for the new activity then click next enter a new name for your scheduled task

  4. It’s now time to set the trigger. Choose When I log on, and click Next. choose the trigger for your scheduled task

  5. Under Action, choose Start a program, and click Next. [enter image description here

  6. Click Browse

  7. Choose the Unicontroller.exe file

  8. Add the following arguments start_both

  9. Check the box Open the Properties dialog for this task when I click Finish then click finish click open the properties dialog when i finish in scheduled tasks

  10. A new window should now open called Properties for ____(Local Computer). On the opened tab, check Run with highest privileges then click OK. click run with highest privileges in task scheduler

1
  • good alternative. thanks for your contribution
    – acgbox
    May 25, 2021 at 12:48
0

The following solved the problem:

First: Change false to true in \UniServerZ\home\us_config\us_config.ini

RunAtPcStartUpEnabled=true
RunApacheAtStartUp=true
RunMysqlAtStartUp=true

Second: Open CMD with administrative privileges and run the following commands:

REG ADD "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Run" /V "UniServerRun" /t REG_SZ /F /D "%homedrive%\UniServerZ\UniController.exe pc_win_start"

Or on some win x64:

REG ADD "HKLM\SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Run" /V "UniServerRun" /t REG_SZ /F /D "%homedrive%\UniServerZ\UniController.exe pc_win_start"

and reboot...

PD: To delete the registry keys:

REG DELETE "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Run" /V "UniServerRun" /F

or

REG DELETE "HKLM\SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Run" /V "UniServerRun" /F

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .