I mainly do web development on my 15 in Macbook Pro. Mac runs on base Unix foundation so mainly you could install almost all Linux/Unix software on Mac very easily.
Change web root apache mac OS X. Ask Question Asked 8 years, 7 months ago. Active 2 years, 3 months ago. Viewed 82k times 21. I cant change my web root in apache, for some reason it points to /Sites/folder1/folder2 instead of it pointing to /Sites. How can I start PostgreSQL server on Mac OS X? Changing documentroot for apache on. The project is jointly managed by a group of volunteers located around the world, using the Internet and the. This was developed into Rhapsody in 1997, Mac OS X Server 1.0 in 1999, Mac OS X Public Beta in 2000, and Mac OS X 10.0 in 2001. In 1999, Apple announced it would release the Mach 2.5 microkernel, BSD Unix 4.4 OS, and the Apache Web server components of Mac OS X Server. Install Apache for Mac OS X. Mac OS is ultimately built on Unix so its very easy to install any Unix supporting softwares. Even better part is that Mac OS X comes with apache web server and we just need to start it and make some changes to setup our development environment.
Mac OS X comes by default with ApacheWeb Server and PHP. In this tutorial we will go over steps on how to enable those on Mac.
Let's get started:
Enable Apache Web Server
Step-1
Open terminal App and run below command:
Step-2
Open browser and check with URL: http://localhost
Enable PHP Module and verify Perl module
Step-1
Open Terminal
App. Mac OS X comes by default with Perl library
. Just type below commands to check Perl and PHP Setup.
2 4 6 8 10 12 14 16 18 | /usr/bin/perl bash-3.2# pwd total120 -rw-r--r--1root wheel13077Sep92014magic drwxr-xr-x14root wheel476Sep92014extra -rw-r--r--1root wheel20786Sep92014httpd.conf -rw-r--r--1root wheel20786Jun913:55httpd.conf.bak bash-3.2# vi httpd.conf |
Step-2
Open file httpd.conf
file. You may use any Text Editor
also.
Uncomment the following line (remove #): LoadModule php5_module libexec/apache2/libphp5.so
Step-3
Restart Apache Web Server:
Step-4
- Find
DocumentRoot
fromhttpd.conf
file. In my case it's/Users/crunchify/Documents/Blogs/MAMP
as I'm using MAMP on my Mac. - You may have diff folder something like
/Library/WebServer/Documents/
. - Create below file
crunchify-php-on-mac.php
under your DocumentRoot folder. - If you don't see folder
Web Server
then just create it 🙂
2 4 6 8 | <head> </head> echo' Hello World - PHP Testcase on Mac OS X by Crunchify.com.. Have a fun. Enjoy.';?> </html> |
Step-5
Now visit this URL: http://localhost/crunchify-php-on-mac.php
and you should see php file loaded successfully on browser.
How to Kill Apache httpd process on Mac?
Just incase if you need to kill apache httpd process on Mac then you could use below commands.
2 | sudo launchctl unload/System/Library/LaunchDaemons/org.apache.httpd.plist |
Enjoy and Happy coding…
Join the Discussion
If you liked this article, then please share it on social media or leave us your comments. Limited time 3 months free WPEngine hosting.
Other Popular Articles..
May 4, 2013 11:51 PM
Configure Apache Web Server Mac Os X
Great guide, thanks John.
Make bootable usb software for mac.
Based on the input given by the user, nutrition suggestion, and food intakes are also suggested by this journal. Food journal printable.
Just a note, in case anyone has the same issue. At first I couldn't get this to work. I tried logging out and back in (still no joy), then restarting the mac (still no joy).
Try doing both of those first. However, if, like me, you still can't get the local host site to load, try the following: You should find a file at /Library/WebServer/Documents/index.html.en . This contains the text 'It works!' referred to in the post. What I did was duplicate that file in the same folder and changed the duplicate's name to 'index.html', leaving the original in situ.
Mac Os Web Server
Both local and user sites then loaded. After which, I was able to delete the duplicated file and everything now works without issue. Just to be clear, leave the original file index.html.en where it is, untouched and unharmed throughout this step.
Not sure why I had to take this mysterious detour - probably something local to my machine, but if you're having trouble after following the guide above, see if it helps.
Download Apache Web Server
May 4, 2013 11:51 PM