Homebrew Apache

Posted on  by admin

Brew install -v homebrew/apache/httpd22 -with-brewed-openssl -with-mpm-event Error: homebrew/apache was deprecated. This tap is now empty as all its formulae were migrated. I got the same problem with apache not able to find php 7's libexec folder, but on 10.11, so the build of Apache is not at issue here. The problem started when a recent Homebrew update moved the install location, but I can't put my finger on where libphp7.so went. Set Apache Port The Homebrew’s version of httpd uses port 8080. You have to manually change the listen port from the default of 8080 to standard port 80. Find the line with Listen 8080 and change it to Listen 80. The cause is homebrew installs apache2/httpd in user accessible folders and runs as a user (by running the command: brew services start httpd). Not running as a regular user means httpd can not listen on privileged ports (1024 and below).

Homebrew apache co

What is BAMP?

BAMP (Brew+Apache+MongoDB+PHP) is a small macOS utility to manage your local server based on Apache + MongoDB + PHP using the Homebrew toolkit.

The tool assumes that you have installed PHP using Homebrew.

Apache and MongoDB are not required to be installed using Homebrew, but I recomend to install them using homebrew.

Download

It is free and open source. Download the last version here.

Why BAMP if there is MAMP, XAMP, etc…?

I have been using MAMP for years now, but I don’t like to wait others to update so I prefere use my own server setup (and I love how homebrew do its job).

Required tools

You only need to have installed the Homebrew in your system (if you are already not using it, don’t lose time reading this and install it!).

Homebrew apache zeppelin

Installation

To install MongoDB: brew install mongodb

Follow those instructions about how to install Apache and multiple PHP versions in your system.

Remember to configure your php.ini and maybe some configs in httpd.conf.

Homebrew apache zeppelin

If you will control your Apache with BAMP, the PHP Switcher Script is not required, BAMP is a PHP Switcher!

Troubleshootings

I’m sure at 99% that your PHP code will not run on your first try, and your fancy php code <?php echo 'Hello world!'; will be printed in screen instead of your message. Well, maybe it is because you missed to tell apache how to run PHP code. In httpd.conf append AddType application/x-httpd-php .php in <IfModule mime_module> section.

Oh! Why index.php is not working! You missed to tell Apache to recognise index.php! In httpd.conf search IfModule dir_module and add index.php.Example:<IfModule dir_module> DirectoryIndex index.html index.php</IfModule>

The mongodb extension on macOS High Sierra is not working! To fix this headache follow those instructions.

How to use BAMP

Just push the ON button and Apache will run up. Push OFF and Apach will stop.

You can change at any time the PHP to use in your Apache, simple select one PHP version and tachan!

Also you can configure multiple DocumentsRoot and select one of them at any time.

The server will continue running up, even when BAMP is not running! What does it means? You don’t need BAMP keept open to use your server! ;)

Special considerations

The apache is started up using sudo apachectl start, so if you restart your computer you will need to start Apache again.

The MongoDB server will be started-up automatically, but if an instance of mongod is already running when starting Apache, then BAMP will not manage the start-stop of mongod!

Icon credits

The icon is based on icons8 parrot icon!

add_apache_brew.md

commented Nov 4, 2016

Hello,
Awesome tuto!
I did everything you mentioned but when i try to execute my project url i have a 500 error and the log file says :
[Fri Nov 04 15:43:08 2016] [error] [client 127.0.0.1] FastCGI: incomplete headers (0 bytes) received from server '/php-fpm'

Could you plase help me ?
Thanks a lot!

Thomas

Apache

commented Apr 19, 2017

Homebrew apache zeppelin

commented Apr 23, 2017

Homebrew Apache Bench

Thanks @vitorbritto!
Things seem to be working, but I got the warning that '--with-brewed-openssl' was not an option for the formula.

One change you might want to consider is changing:
'brew install -v homebrew/apache/mod_fastcgi --with-brewed-httpd22'
to
'brew install -v homebrew/apache/mod_fastcgi --with-homebrew-httpd22'
I got the warning that the brewed option was deprecated.

Homebrew Apache

commented Apr 25, 2018

brew install -v homebrew/apache/httpd22 --with-brewed-openssl --with-mpm-event
Error: homebrew/apache was deprecated. This tap is now empty as all its formulae were migrated.

Homebrew Apache Directory Studio

Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment