Sunday, August 4, 2019

macos - I can't get XAMPP to start automatically in OS X


I can't get XAMPP to start when OS X boots. I've been researching this for some time but with no luck. XAMPP needs to be started as root, and I don't want to store the password for root in a script somewhere and use the "login items" of the accounts pref pane to start xampp. Yes, that will work, but it's not the right way.


I'm trying to launch it using launchd / users damons / LaunchDaemons. That includes creating a plist file in the "/Library/LaunchDaemons" directory.


I created a file called xampp.startapache.plist and put this inside:







EnableTransactions

Label
xampp.startapache
ProgramArguments

/Applications/XAMPP/xamppfiles/xampp
startapache

RunAtLoad

WorkingDirectory
/Applications/XAMPP/xamppfiles



That was outlined here as well as on several other similar help pages. I've tried editing the files manually, and I've also tried using Lingon. But it just dosen't work! I've even tried doing a similar entry for a script file located in the same directory, which would echo the time to a log file. The log file is just blank - like the script is not being run.


How can I make this work?


Answer



Here's what ended up working for me:


Create these two files:



/Library/LaunchDaemons/xampp.sql.startapache.plist
/Library/LaunchDaemons/xampp.startapache.plist

Inside the first one, add this code:







EnableTransactions

Label
xampp.startapache.mysql
ProgramArguments

/Applications/XAMPP/xamppfiles/xampp
startmysql

RunAtLoad

WorkingDirectory
/Applications/XAMPP/xamppfiles
KeepAlive

AbandonProcessGroup




In the second one add this code:







EnableTransactions

Label
xampp.startapache
ProgramArguments

/Applications/XAMPP/xamppfiles/xampp
startapache

RunAtLoad

WorkingDirectory
/Applications/XAMPP/xamppfiles
KeepAlive

AbandonProcessGroup




I had to have two because when I didn't have the sql one specifically mysql wasn't starting but apache was. This may be because I have SSL enabled or something weird like that. Anyhow, having both of them solved the problem for me, and I did use the Console.app to check for error messages when starting apache - that was helpful, too.


No comments:

Post a Comment

hard drive - Leaving bad sectors in unformatted partition?

Laptop was acting really weird, and copy and seek times were really slow, so I decided to scan the hard drive surface. I have a couple hundr...