top of page
  • Bankim Bhagat

Install Apache, PHP on macOS Catalina 10.15

Open Terminal. Terminal is found at /Applications/Utilities/Terminal.

sudo apachectl start

Now open Safari / Chrome /any other web browser and type localhost. Hit Enter You’ll see this

Now go back to Terminal & create “Sites” folder in home directory

cd && mkdir Sites

Next we need to configure the Apache Server by editing the httpd.conf located in /etc/apache2/

sudo nano /etc/apache2/httpd.conf

Uncomment the following lines by removing the preceding #

LoadModule authz_core_module libexec/apache2/mod_authz_core.so LoadModule authz_host_module libexec/apache2/mod_authz_host.so LoadModule userdir_module libexec/apache2/mod_userdir.so LoadModule include_module libexec/apache2/mod_include.so LoadModule rewrite_module libexec/apache2/mod_rewrite.so LoadModule php7_module libexec/apache2/libphp7.so Include /private/etc/apache2/extra/httpd-userdir.conf Include /private/etc/apache2/other/*.conf

A simpler way to find these lines is to use the search feature of the nano text editor. Hit (ctrl + w) to open the search bar.

Save all your changes (ctrl + o). Exit nano text editor (ctrl + x)

Next edit httpd-userdir.conf

sudo nano /etc/apache2/extra/httpd-userdir.conf

Uncomment the following line (by removing #)

Include /private/etc/apache2/users/*.conf

Add a “username.conf” (replace username with your username) file under: /etc/apache2/users/

cd /etc/apache2/users

sudo nano username.conf

Replace the contents of the file with the following code. Replace username with your username

<Directory "/Users/username/Sites/"> AllowOverride All Options Indexes MultiViews FollowSymLinks Require all granted </Directory>

Save all changes (ctrl + o). Exit Editor (ctrl + x)

Give permissions to the file

sudo chmod 644 username.conf

Restart Apache Server

sudo apachectl restart

Goto Web Browser, type localhost/~username. If everything goes well, you should see something like this

7 views0 comments

Recent Posts

See All
bottom of page