Restart (stop/start) Apache via (unix) command line?

Problems with the Mac OS X version of XAMPP, questions, comments, and anything related.

Restart (stop/start) Apache via (unix) command line?

Postby mhulse » 15. July 2014 01:37

I'd like to create a bash alias/function that will start/stop XAMPP's Apache.

I've found /Applications/XAMPP/xamppfiles/apache2/scripts/ctl.sh

Within, it has start_apache() and stop_apache() commands.

I've tried running those functions via the command line but nothing seems to work. The .sh file is executable, so I should be good on the permissions tip:

Code: Select all
-rwxrwxr-x  1 root  admin   2.3K Mar  6  2013 ctl.sh*


Is there any way to make this work?

Thanks!
mhulse
 
Posts: 3
Joined: 15. July 2014 01:33
Operating System: OS X

Re: Restart (stop/start) Apache via (unix) command line?

Postby Nobbie » 15. July 2014 09:42

I dont know the OSX Version, but under Linux there is a script called "lampp" which is stored in /opt/lampp (should be equivalent to /Applications/XAMPP/ or /Applications/XAMPP/xamppfiles) and which does exactly what you are looking for.

With

sudo ./lampp start
sudo ./lampp stop
sudo ./lampp restart

you may start/stop everything. There are also subcommands only for Apache, MySQL, but i did not ever use them and dont know how they are called.

Dont know if this helps you.
Nobbie
 
Posts: 8780
Joined: 09. March 2008 13:04

Re: Restart (stop/start) Apache via (unix) command line?

Postby mhulse » 15. July 2014 22:20

Oooh, nice!

Code: Select all
$ sudo /Applications/XAMPP/xamppfiles/xampp restart
Password:
Restarting XAMPP for Mac OS X 1.8.3-4...
XAMPP: Stopping Apache...not running.
XAMPP: Stopping MySQL...not running.
XAMPP: Starting Apache...ok.
XAMPP: Starting MySQL...ok.


Bash aliases:

Code: Select all
# XAMPP shortcuts:
alias xampp='sudo /Applications/XAMPP/xamppfiles/xampp restart'
alias xampp_stop='sudo /Applications/XAMPP/xamppfiles/xampp stop'
alias xampp_start='sudo /Applications/XAMPP/xamppfiles/xampp start'


Now I can just call xampp from the command line and Apache will restart (as sudo).

Appears to work. Nice!

Note that the above commands also enable MySql.

Thanks for the help Nobbie! I really appreciate it!!!!
mhulse
 
Posts: 3
Joined: 15. July 2014 01:33
Operating System: OS X


Return to XAMPP for Mac OS X

Who is online

Users browsing this forum: No registered users and 6 guests