Search code examples
mysqlpython-2.7apachexamppjython

Start XAMPP Control Panel Apache MySql from Python 2.7 script


I would like to automatically start Apache and MySql of the XAMPP Control Panel without having to make it to the users of the application. Using Python 2.7
The buttons are highlighted below.

XAMPP Control Panel v3.2.4

Thanks in advance!


Solution

  • Open Windows Command Prompt as Administrator

    Type 'net start' to see a list of running services windows.

    locate the name for service e.g. "Apache2.4"

    write python command to start/stop/restart service....

    import win32serviceutil
    win32serviceutil.StartService('Apache2.4')
    win32serviceutil.RestartService('Apache2.4')
    win32serviceutil.StopService('Apache2.4')