![]() ![]() Set the permission of the user configuration file by typing the following in your Terminal sudo chmod 644 "/etc/apache2/users/ nf" If you are running Apache 2.4.2 + use this: Options FollowSymLinks Indexes MultiViews If you are running Apache 2.4.1 and earlier use this: * Important: the directory path in the first line is case sensitive. Replace with your username sudo nano "/etc/apache2/users/ nf"Īdd the following lines to the file. Using nano will open the file if it already exists or create it if it doesn’t. To host files in your Sites/ directory you will need to create a user file for your osx user (use the user short name, if unsure of what it is go /Users directory and you will see the short names of all the users)Ĭreate the file by typing the following in your Terminal. Write your Server version down for future reference. LoadModule userdir_module libexec/apache2/mod_userdir.so ![]() This will enable the ability to use the users/ configuration files. While the nf file is still open search for the following two lines and remove the comment # from in front as well if it isn’t already. LoadModule php7_module libexec/apache2/libphp7.so So if you’re using that then you will want to uncomment this line instead. ![]() Important* macOS Catalina comes with PHP 7 preinstalled. Remove the # in the front of the line commenting it out. Now that the file is open, find the line where LoadModule php5_module libexec/apache2/libphp5.so is commented out. Inside your Terminal window type the following command to open the nf file in the editor nano sudo nano /etc/apache2/nf You will need to edit your Apache Httpd configuration file to enable PHP. If this page isn’t loading, type the following command into your Terminal to see if there is a configuration error. Congratulations you now have a running Apache server. If you open your internet browser and navigation to You will see the following. To restart the Apache server type sudo apachectl restartĪs was pointed out in the comments by Vince and others, for people new to this command the last letter in apachectl is the letter l and not the number 1. To stop the Apache server type sudo apachectl stop To start the Apache server type the following command in your Terminal window sudo apachectl start Open your Terminal (found in your Utilities folder which is inside your Applications folder) What green means: any lines that you need to replace in this tutorial will be in green.Īpache comes preinstalled on Apple OS X 10.8+ (Mountain Lion, Mavericks, Yosemite, Etc) Any files previously stored in the root directory are moved to /Users/Shared/Relocated Items/Security/.If you upgraded from a previous version of OSX your hosting environment will be broken.Apple locked files on the root directory, but it’s still possible to set up.What you need to know since the release of Catalina Apple changed the way global permissions are given to users/ directory.What you need to know since the release of Yosemite Apache is still installed on your Mac by default.Apple dropped the GUI option to turn on web sharing, but it’s still possible to do manually.Apple changed its hosting environment for OSX 10.8 +.What you need to know since the release of Mountain Lion + Tested on OS X Mountain Lion, OS X Mavericks, OS X Yosemite 10.10+, macOS El Capitan, macOS Catalina This tutorial will show you how to set up an Apache server to run PHP on a mac OSX 10.8+ with Mountain Lion or later operating system. ![]()
0 Comments
Leave a Reply. |