How to run Apache/MySql from command prompt

Problems with the Windows version of XAMPP, questions, comments, and anything related.

How to run Apache/MySql from command prompt

Postby JustMe » 22. March 2010 20:47

Hi all,

Where do I find docs on running Apache and MySQL from the command prompt (vs. setting it to run as a service or using the XAMPP control panel)?

I have login scripts that check my location and domain and then run the software that is appropriate (IIS, Apache, Glassfish, MySql, MS SQL, Postgres, Eclipes, Netbeans, etc.) for the site where I am currently located. I hate having to start these from the XAMPP control panel, but don't want them running as a service.

Any idea?

Thanks,

JustMe
JustMe
 
Posts: 12
Joined: 22. March 2010 20:34

Re: How to run Apache/MySql from command prompt

Postby Nobbie » 22. March 2010 21:08

You dont need docs about starting Apache or MySQL.

Simply start httpd.exe (Apache) or mysqld.exe (MySQL) from commandline or from explorer (double click). Thats all. You will find the executables in the appropriate bin-folders.
Nobbie
 
Posts: 8772
Joined: 09. March 2008 13:04

Re: How to run Apache/MySql from command prompt

Postby JustMe » 22. March 2010 22:02

Nobbie,

Thanks for your response.

2 things.

1) I am still trying to find out where I can get docs on the command line arguments for the executables in the bin folder.
2) With you help, I can now get Apache running. But MySQL still does not. When I call MySQLd.exe, I get the following errors:

100322 13:52:27 [Warning] Can't create test file \usr\local\mysql\data\Protege.lower-test
100322 13:52:27 [Warning] Can't create test file \usr\local\mysql\data\Protege.lower-test
mysqld: Can't change dir to '\usr\local\\mysql\data\' (Errcode: 2)
100322 13:52:27 [ERROR] Aborting

100322 13:52:27 [Note] mysqld: Shutdown complete

Given that I am running windows, shouldn't it at least show me the paths that exist on my machine?

When I try to run either MySql.exe or MySqlD.exe with flags like ?, /?, /help, etc. I just get errors.

Any more ideas?

Thanks,

JustMe
JustMe
 
Posts: 12
Joined: 22. March 2010 20:34

Re: How to run Apache/MySql from command prompt

Postby JustMe » 24. March 2010 17:22

Hi all,

Well I didn't think what I wanted was that hard and it might have been nice if someone had pointed me in the right direction. Anyway, should anyone search for this (I did first) and not find what they wanted (I didn't), here are the answers.

Don't go to the Apache.org site because they tell you how to do it with a standard install, which XAMPP doesn't do (this is not bad, just FYI)

Here is the code for a batch file that will
1) Start Apache and MySql
2) Load the control pannel
3) Run Netbeans (or change it to your editor of choice)
4) Not wait for you to exit any of those before it will exit (say for an autoexec script)
5) Note that the last use of start uses a path directive as well as the shortcut (.lnk) instead of calling the .exe directly. This approach allows you to configure the shortcut to run the way you want using the shortcut (vs. command line args).

REM Start Apache with no new window
call C:\xampp\apache_start.bat < crlf.txt
REM Start MySQL
call C:\xampp\mysql_start.bat < crlf.txt
REM start the control panel minimized
start "Startup Title" /MIN "c:\xampp\XAMPP-Control.exe"
start "Startup Title" "c:\Program Files\Mozilla Firefox\firefox.exe"
start "Startup Title" /D "C:\Users\developerAcct\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\netbeans\" "NETBEANS.LNK"

A couple of things. The crlf.txt file simply gets around the PAUSE in the XAMPP batch files. I could have edited those, but this way, I can reinstall and not have to remember to edit them again.

You can get info on START by just entering Start /? at a command prompt.

In my case, when my computer starts, it checks the domain. If I am at a clients where we use LAMP, then this script runs. Otherwise, whatever sript that is appropriate will run. I also use SET directives instead of actual paths so that those to can be configured by the environment.

ANyway, feel free to contact me if you want more details.

JustMe
JustMe
 
Posts: 12
Joined: 22. March 2010 20:34


Return to XAMPP for Windows

Who is online

Users browsing this forum: No registered users and 73 guests