- Set up a local web server mac os x how to#
- Set up a local web server mac os x install#
- Set up a local web server mac os x full#
Set up a local web server mac os x install#
Install and reinstall apps from the App Store.If you want to add modules to PHP, I suggest the following site. If you want to setup MySQL, see my User Tip on Installing MySQL. You should see the string "mod_perl/2.0.5". Create a Perl test file with:Įcho "print \$ENV " > ~/Sites/ You should see your PHP configuration information. Create a PHP info file with:Īnd test it by entering the following into Safari's address bar: In Safari, navigate to your web site with the following address: It must also be checked to enable Apache. There is a "Web Sharing" button in System Preferences > Sharing.
Sudo launchctl load -w /System/Library/LaunchDaemons/ Turn on the Apache httpd service by running the following command in the Terminal: But for a development server, you don't need to do anything. You could fix this by setting the ServerName directive in /etc/apache2/nf and adding a matching entry into /etc/hosts. It may also print a warning saying "httpd: Could not reliably determine the server's fully qualified domain name". If this command returns "Syntax OK" then you are ready to go. Check your configuration by running the following command in the Terminal: Sometimes copying and pasting from an internet forum can insert invisible, invalid characters into config files. Now you are ready to turn on Apache itself. To create one manually, enter the following:Įcho "My site works" > ~/Sites/ If you already had a Sites folder in Snow Leopard, it should still be there. Lion and later versions no longer create personal web sites by default. (Hint: in vi, type "dd" (without the quotes) to delete a line.) Options Indexes MultiViews FollowSymLinks ExecCGI In /etc/apache2/users/.conf change the line that says: Then, configure Perl to run from any directory like PHP. Press the "esc" key to return to command mode. Type the line above or paste is from the clipboard. (if you aren't familiar with vi, go to line 111 and type "o" (without the quotes) to create a new blank line and enter editing mode. LoadModule perl_module libexec/apache2/mod_perl.so
Set up a local web server mac os x full#
To enable full Perl support in Apache, insert the following at line 112, just after the libphp5.so line: If you want to run Perl scripts, you will have to do something similar:īy default, Apache in Lion is not configured to support the Perl module.
Then type ':w!' to save, or just 'ZZ' to save and quit.) Then just press 'x' over the '#' character to delete it. (If you aren't familiar with vi, go to line 111 by typing "111G" (without the quotes). LoadModule php5_module libexec/apache2/libphp5.so #LoadModule php5_module libexec/apache2/libphp5.so To get started, edit the Apache configuration file as root:Įnable PHP by uncommenting line 111, changing: Lines in bold courier should be typed at the Terminal. Lines in bold are what you will have to type in. Xcode is required for adding PHP modules.
Set up a local web server mac os x how to#
Basic understanding of Terminal.app and how to run command-line programs.For things like database, web, and mail services, I have found it easier to just setup the client OS version manually. Server does a few specific tricks really well and is a good choice for those. Pay attention to your OS version.Īnother note: These instructions apply to the client versions of MacOS X, not Server. Note: This user tip is specific to MacOS X 10.7 “Lion”. I have another User Tip for installing and configuring MySQL and email servers. This User Tip only contains instructions for configuring the Apache server, PHP module, and Perl module. This is meant to be a development platform so that you can build and test your sites locally, then deploy to an internet server. Here is my definitive guide to getting a local web server running on MacOS X 10.7 “Lion”.