Last active
August 1, 2023 17:41
-
-
Save claudiainbytes/bea0301cf2cc98beb30266334bf5eaa0 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
####### Apache Installation | |
sudo apachectl stop | |
sudo launchctl unload -w /System/Library/LaunchDaemons/org.apache.httpd.plist 2>/dev/null | |
brew install httpd | |
#Now we just need to configure things so that our new Apache server is auto-started | |
sudo brew services start httpd | |
#You can see Apache running on the browser by default http://localhost:8080 | |
#Useful commands | |
sudo apachectl start | |
sudo apachectl stop | |
sudo apachectl -k restart | |
#Modifying http.conf in /usr/local/etc/httpd/httpd.conf | |
cd /usr/local/etc/httpd | |
sudo vi http.conf | |
#Listen 8080 | |
Listen 80 | |
... | |
#DocumentRoot "/usr/local/var/www" | |
DocumentRoot /Users/your_user/Sites | |
... | |
<Directory /Users/your_user/Sites> | |
... | |
#AllowOverride None | |
AllowOverride All | |
... | |
#Enable this | |
LoadModule rewrite_module lib/httpd/modules/mod_rewrite.so | |
... | |
#Set the user and group | |
#User _www | |
#Group _www | |
User claudiainbytes | |
Group staff | |
... | |
#ServerName www.example.com:8080 | |
ServerName localhost | |
... | |
#Restart Apache | |
sudo apachectl -k restart | |
#Pointing your browser to http://localhost should display your new message. | |
###### PHP Installation | |
#We will proceed by installing PHP 5.6, PHP 7.0, PHP 7.1 and PHP 7.2 and using a simple script to switch between them as we need. | |
brew install php56 --with-httpd | |
brew unlink php56 | |
brew install php70 --with-httpd | |
brew unlink php70 | |
brew reinstall php71 --with-httpd | |
brew unlink php71 | |
brew reinstall php72 --with-httpd | |
#Let's switch back to the first PHP version now: | |
brew unlink php70 | |
brew link php56 | |
##### Apache PHP Setup - Part 1 | |
LoadModule php5_module /usr/local/Cellar/php56/5.6.33_9/libexec/apache2/libphp5.so | |
LoadModule php7_module /usr/local/Cellar/php70/7.0.27_19/libexec/apache2/libphp7.so | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
On my system, in
/usr/local/etc/httpd/httpd.conf
I had to addIt may also be convenient to add
index.php
here