Skip to content

Instantly share code, notes, and snippets.

@michelve
Last active February 23, 2017 18:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save michelve/0daa36d7095df66cb769a9ce648a7bd2 to your computer and use it in GitHub Desktop.
Save michelve/0daa36d7095df66cb769a9ce648a7bd2 to your computer and use it in GitHub Desktop.
Install PHP and MySQL on OSX
#!/usr/bin/env bash
#install php:
##https://getgrav.org/blog/macos-sierra-apache-multiple-php-versions
#---------------
# bash <(curl -Ls https://git.io/vyeNE)
#PHP 7.1 (Current stable) - 10.10 and later
curl -s https://php-osx.liip.ch/install.sh | bash -s 7.1
# add export line
export PATH=/usr/local/php5/bin:$PATH
# virtualhost
# copy and symlink from pilotkit master files
sudo mv /private/etc/apache2/httpd.conf /private/etc/apache2/httpd.conf.pk
sudo mv /private/etc/apache2/extra /private/etc/apache2/extra_pk
sudo ln -s /Applications/PilotKit/Sites/config/OSX/httpd.conf /private/etc/apache2/httpd.conf
sudo ln -s /Applications/PilotKit/Sites/config/OSX/extra /private/etc/apache2/extra
# permisison for user _www
sudo dseditgroup -o edit -a _www -t user admin
sudo dseditgroup -o edit -a _www -t user wheel
sudo chmod a+rwx /Applications/PilotKit
# install MySQL
if type mysql >/dev/null 2>&1; then
echo "MYSQL exists"
else
bash <(curl -Ls http://git.io/eUx7rg)
fi
# start apache service
sleep 1
sudo apachectl start
sudo launchctl load -w /System/Library/LaunchDaemons/org.apache.httpd.plist
# to stop autoload
# sudo launchctl unload -w /System/Library/LaunchDaemons/org.apache.httpd.plist
exit 0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment