Httpd on Mac: Difference between revisions

From NovaOrdis Knowledge Base
Jump to navigation Jump to search
Line 44: Line 44:
==Configure PHP==
==Configure PHP==
Install as shown here: {{Internal|PHP#Mac|PHP Installation on Mac}}
Install as shown here: {{Internal|PHP#Mac|PHP Installation on Mac}}
Add the following to <code>httpd.conf</code> and restart Apache:
<syntaxhighlight lang='xml'>
LoadModule php_module /opt/brew/opt/php/lib/httpd/modules/libphp.so
<FilesMatch \.php$>
  SetHandler application/x-httpd-php
</FilesMatch>
</syntaxhighlight>


==Miscellaneous==
==Miscellaneous==


Set <code>ServerName</code> to localhost:8080.
Set <code>ServerName</code> to localhost:8080.

Revision as of 02:38, 29 December 2023

Internal

Installation

Httpd Installation on Mac

Start

/opt/brew/opt/httpd/bin/httpd -D FOREGROUND

Start at Boot

sudo brew services start httpd

Directory Layout

/opt
 └── brew
      ├── Cellar
      │     └── httpd
      │          └── 2.4.58
      │               └── bin
      │                    └── httpd
      ├── etc
      │    └── httpd
      │         ├──  httpd.conf # Main configuration file
      │         └──  extra
      │               └──  httpd-ssl.conf
      ├── opt
      │    └── httpd
      │        └──  bin
      │              └──  httpd
      └── var
           ├── www   # Document root
           │    └──  index.html
           │ 
           └── homebrew
                └──  linked
                      └──  httpd

Configuration

Configure PHP

Install as shown here:

PHP Installation on Mac

Add the following to httpd.conf and restart Apache:

LoadModule php_module /opt/brew/opt/php/lib/httpd/modules/libphp.so

<FilesMatch \.php$>
  SetHandler application/x-httpd-php
</FilesMatch>

Miscellaneous

Set ServerName to localhost:8080.