Install Apache Macos Catalina

  1. Install Apache Macos Catalina Update
  2. Install Apache Macos Catalina Operating System
  3. Install Apache On Macos Catalina

In this tutorial we will learn to install Apache, MySQL, PHP on macOS Catalina 10.15. About macOS Catalina. Apple released macOS Catalina 10.15 on 7th October 2019 and it includes Apache and PHP. So, all we have to do is enable them. Then install MySQL and we are ready for development. So, lets get started. Install Apache, MySQL, PHP on macOS 11 Big Sur and Reset Forgotten Admin Password on macOS Big Sur and Installing node.js on macOS Big Sur and earlier Enable the root user in macOS Big Sur and earlier Where is the bash shell in macos Big Sur and Catalina? How to Add to the Shell Path in macOS Big Sur.

  • Maria Campbell provides a post on installing the latest version of Python on Mac OS Catalina and overriding the old default pre-installed version. And it even uses Homebrew and not some gnarly steps. I finally did it. I successfully installed Python version 3.7.7 via Homebrew on my Mac laptop with OS Catalina installed.
  • The current Apache OpenOffice supports Apple OS X version 10.7 (Lion), 10.8 (Mountain Lion), 10.9 (Mavericks), 10.10 (Yosemite), 10.11 (El Capitan) and macOS 10.12 (Sierra), 10.13 (High Sierra), 10.14 (Mojave), 10.15 (Catalina). The last OpenOffice version supporting Mac OS X 10.4 (Tiger), 10.5 (Leopard), 10.6 (Snow Leopard) is OpenOffice 4.0.1.

The title of this page is quite 'misleading' as both Apache and PHP comes pre-bundled in macOS Catalina 10.15. We merely need to configure them.

Press + SPACE (Spotlight Search) and bring up the terminal. Start as root

1) The Apache HTTP Server

As Apache 2.4 comes pre-packaged in macOS Catalina 10.15, check the version to verify

If the version number is proper, start the server by running the command

Next, type http://localhost in the URL bar of the web browser. It should display the It works! page.

2) The It works! Page Location

The default It works! page is located inside /Library/WebServer/Documents as the index.html.en file.

3) Changing the Work Directory

Get back to the login directory typing

Navigate to your home directory (it is named with your user name). In my case, it is dennisgabil

There, create a directory for your web projects, say Sites

For easy access later, you can place this newly created Sites directory in the Favorites section of your Mac's Finder. Do Spotlight Search ( + SPACE) on your username and drag and drop Sites to the Finder sidebar.

4) Modifying httpd.conf

Next, navigate to /etc/apache2

Create a backup of the httpd.conf file

We need to make some changes to the httpd.conf file. Open it with vi editor

Find the line

#LoadModule php7_module libexec/apache2/libphp7.so

and uncomment it, i.e., remove # (focus the cursor on # and press x).

Macos

Then find the two lines below

DocumentRoot '/Library/WebServer/Documents'
<Directory '/Library/WebServer/Documents'>

and change them to

DocumentRoot '/Users/dennisgabil/Sites'
<Directory '/Users/dennisgabil/Sites'>

(You change /dennisgabil/ in the two paths to your /username/ ). For inserting text in vi, press i. Save the changes (press ESC, then : (SHIFT + :), then wq!)

5) Restart Apache

Restart the server by running the command

Now all your web projects can go inside /Users/dennisgabil/Sites. If you have a web project called, say, myproj, inside that directory, you can access it by typing localhost/myproj in the URL bar of your browser and it will display your default index.html (or index.php, keeping in mind that we are learning PHP) file. If you have a Git repository for your project, you can clone it there and work.

Just for the purpose of testing, create an index.php page that displays Hello, World! inside the /Sites directory (do not forget to change /dennisgabil to your /username in the path)

Access http://localhost. The page should display Hello, World!

Question or issue on macOS:

I have Apache webserver (the one supplied by Apple) running on my Macbook and it ran flawlessly, until I upgraded to Catalina 10.15.
I used the same httpd.conf, but now it is displaying

You don’t have permission to access this resource.Server unable to read htaccess file, denying access to be safe

I thought is was folder access by Catalina, but I don’t know how to let Apache access the web root folder (which is inside my /Users/me/Documents folder)as Apache is not a normal /Application.

Port 80 is open when I check with lsof -nP -i4TCP:80 | grep LISTEN op nmap, so Apache does start.

I set a simple index.html in the root folder, but the problem persists.
And when I remove the .htaccess from the Apache root folder I get:

Install apache macos catalina download

You don’t have permission to access this resource.

Additionally, a 403 Forbidden error was encountered while trying to use an ErrorDocument to handle the request.

What can be the problem here ?

How to solve this problem?

Solution no. 1:

I have found the solution, myself.

It is a Catalina issue:

Install Apache Macos Catalina
  1. Go to System Preferences => Security & Privacy => Full Disk Access
  2. Click on the “+” button to add an app and go to the root folder of the disk and press
    Cmd + Shift + .(dot)
  3. Go to /usr/sbin/ and select httpd.

That worked for me.

Solution no. 2:

i had the same error, the problem in my case was that macOS Catalina comes with the php module disable by default, in the error log apear as:

tail /private/var/log/apache2/error_log


[Wed Feb 26 18:10:57.123036 2020] [autoindex:error] [pid 3145] [client
127.0.0.1:53734] AH01276: Cannot serve directory /Library/WebServer/Documents/subdir/: No matching DirectoryIndex
(index.html) found, and server-generated directory index forbidden by
Options directive

the apache server was loking for index.html instead of index.php so it was blocking the list directory, I uncommented the line #LoadModule php7_module libexec/apache2/libphp7.so in /etc/apache2/httpd.conf and restart the apache server


sudo apachectl restart

Install Apache Macos Catalina Update

and it just work. hope it helps.

Solution no. 3:

The above answer save my life!

I tried all the different Apache configs possible, nothing worked.

Just a small correction for step 2 – click on the “+” sign to add an app, navigate to the root folder then press Cmd + Shift + .(dot) which will show all hidden folders and allow you to see the folder in step 3 (/usr/sbin/)

Install Apache Macos Catalina

I wish Apple would have at least shown some error in such a case…

Solution no. 4:

Mac catalina apache forbidden issue

Step 1: sudo code /etc/apache2/httpd.conf

Step 2:search for line #LoadModule php7_module libexec/apache2/libphp7.so
and uncomment no need to delete it.

Step 3: sudo apachectl restart

Step 4: open Web browsers type localhost

Install Apache Macos Catalina Operating System

Step5: Done

Install Apache On Macos Catalina

Hope this helps!

Comments are closed.