
Next you will need to create a phpinfo.php file sudo nano "/Users/ username/Sites/phpinfo.php" sudo chmod 0755 "/Users/ username/Sites"ģ. Be sure to replace username with your actual username. Change the permission of your Sites folder to allow Apache to access your files and folders.Įnter the following command into Terminal. Check that your Sites folder exists in your Users/ username/ directory.

sudo apachectl restartĬreate a test file in your Sites folder called phpinfo.phpġ. In your terminal type the following and press enter to restart your Apache server. Search for the word “override”. On all instances, change AllowOverride None to AllowOverride All. Now press control+w to search in the Nano editor. Many php applications rely on htaccess for URL routing.Īgain open the nf file in your terminal. Sudo nano /etc/apache2/extra/nfįind the next line and make sure the comment is removed # Include /private/etc/apache2/users/*.conf
#Mamp update php how to#
How to make sure user configuration files are enabled: 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)

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
#Mamp update php mac#
#Mamp update php mac osx#
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.
