Menu

Category

Configuring Apache with PHP7 FPM on MacOS Mojave using HomeBrew

November 19, 2019
Configuring Apache with PHP7 FPM on MacOS Mojave using HomeBrew

These installation steps is a basic guide on how to setup Apache Server with PHP7.2 FPM on MacOS Mojave.

Before we start with installation process, let us first —

a. Remove built in Apache and PHP

Remove build in Apache Server for MAC OSX by issuing the following commands:

sudo apachectl stop
sudo launchctl unload -w /System/Library/LaunchDaemons/org.apache.httpd.plist
#Assuming you have PHP 7.2 preinstalled
brew unlink php72

b. Purging Previous Configuration Files (Apache & PHP)

If HomeBrew is already installed and you would like to purge all previous Apache and PHP Configurations:

sudo rm -R /usr/local/etc/httpd
sudo rm -R /usr/local/etc/php

Now, lets install necessary dependencies before beginning the process:

c. Install Xcode CLI tools (if not already installed)

xcode-select --install

d. Install HomeBrew (if not already installed)

Install HomeBrew by issuing the following command:

/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

Run HomeBrew Doctor to check if everything is in oder:

brew doctor
#Your system is ready to brew.

Phew, now that everything else is sorted, lets get to work —

1. Installing Apache using HomeBrew

Lets install and start the Apache Server using Homebrew by issuing the following commands —

brew install httpd24 --with-privileged-ports --with-http
brew services start http

Running Apache on HomeBrew

On HomeBrew Default Ports

By default, HomeBrew Apache v2.4.35 is configured to run on port 8080 while SSL port is configured to run on 8443. If you would like to start Apache then simply issue the command:

apachectl start

If you require Apache to run as a background service(start automatically on restart, requires user log-in) then run the following command:

brew services start httpd24

Now, open up your browser and browse to http://127.0.0.1:8080. You should be able to see “It works!” on the browser!

Run Apache on Standard Port 80

If the apache server is running, then stop the server using the following command:

apachectl stop

In order to configure Apache to run on port 80 then simply open up /usr/local/etc/httpd/httpd.conf and make the following change:

#Find the line with  
Listen 8080

#and change it to  
Listen 80

In order to run Apache on port 80 or any other port ≤1024, you would need to run apache with sudo privileges. Hence, start the apache server using the following command:

sudo apachectl start

Again, if you require Apache to run as a background service(start automatically on restart) then run the following command:

sudo brew services start httpd24

Now, open up your browser and browse to http://l27.0.0.1. You should be able to see “It works!” on the browser!

2. Install latest PHP 7.2 with FPM

Brew is configured to install php with fpm automatically when issuing the following command:

brew install php72

Once complete, confirm that the version of PHP installed is 7.2

php -v
PHP 7.2.10 (cli) (built: Sep 14 2018 07:05:22) ( NTS )
Copyright (c) 1997-2018 The PHP Group
Zend Engine v3.2.0, Copyright (c) 1998-2018 Zend Technologies
    with Zend OPcache v7.2.10, Copyright (c) 1999-2018, by Zend Technologies

In order to start php72 FPM (FastCGI Process Manager), please issue the following command:

sudo brew services start php

3. Configuring Apache to work with PHP FPM

In order to configure apache to work with php fpm please open the /usr/local/etc/httpd/httpd.conf file again and uncomment the following lines to enable the listed php modules:

LoadModule proxy_module libexec/mod_proxy.so 
LoadModule proxy_fcgi_module libexec/mod_proxy_fcgi.so 
LoadModule rewrite_module libexec/mod_rewrite.so

Again on httpd.conf, make the following changes to make Apache load index.php by default

# 
# DirectoryIndex: sets the file that Apache will serve if a directory 
# is requested. 
# 
<IfModule dir_module> 
    DirectoryIndex index.php index.html index.htm 
</IfModule>

Add the following configurations to the /usr/local/etc/httpd/httpd.conf file just under the directory directive:

<VirtualHost *:*>
   ProxyPassMatch "^/(.*\.php(/.*)?)$" "fcgi://127.0.0.1:9000/usr/local/var/www/$1"
</VirtualHost>
<FilesMatch \.php$>
    # 2.4.10+ can proxy to unix socket
    # SetHandler "proxy:unix:/var/run/php5-fpm.sock|fcgi://localhost/"
    # Else we can just use a tcp socket:
    SetHandler "proxy:fcgi://127.0.0.1:9000"
</FilesMatch>

Now, to make the configurations take effect, please restart the Apache Server by issuing the following command:

sudo brew services restart httpd24

Now, create a new php file named test.php under the server directory at /usr/local/var/www/ and add the following content to the file:

<?php echo phpinfo(); ?>

Now, browse to http://127.0.0.1/test.php to check if your Server is able to handle PHP files.

I hope this article has been to some aid to you. Do leave your feedback! Thanks!

Fahim Hossain

Fahim Hossain

With the booming pace of the tech industry, there is a lot to grasp, learn and master. My passion is to work with different architectural design patterns and developing high performance software solutions using the latest technology stacks. I am the founder of ARITS Limited and am currently serving as its Chief Executive Officer

Please leave your feedback “Configuring Apache with PHP7 FPM on MacOS Mojave using HomeBrew

Alternative Top-Qualitat

Prescription OFF.

https://medikamente365.space/doxepin-rezeptfrei-kaufen/

Internet Drugstore No Prescription! Buy Cialis online from an official.

Your comment is awaiting moderation.

Reply
Rabatt Kaufen

One should try and avoid healthcare with viagra or viagra 1000mg countries.

https://medikamente365.space/bisoprolol-bestellen/

Generic and Brand Kamagra Online. Have More Sex, Erfahrungen Online Apotheke Cialis.

Your comment is awaiting moderation.

Reply
Preis Generika

National heart and lung by the proteins in ready to party. Brand Viagra Cialis Levitra online without.

https://pillerezeptfrei.space/toracard/

Precautions. Offering Viagra online for less.

Your comment is awaiting moderation.

Reply
Kostengunstig Generika

Generisches Viagra kaufen, viagra 50mg online, Albanime.

https://pillerezeptfrei.space/gatinar/

High quality is guaranteed.

Your comment is awaiting moderation.

Reply
Verkauf Rezeptfrei

Disclaimer: Sedo maintains no relationship with third party advertisers.

https://pillerezeptfrei.space/clotrigalen/

Without a prior prescription.

Your comment is awaiting moderation.

Reply
Top-Qualitat Verkauf

Full Certified.

https://pillerezeptfrei.space/salmeterol/

Online Apotheke Europa Viagra. Tadalafil 10mg kaufen generika schweiz bestellen, online billig apotheke aus.

Your comment is awaiting moderation.

Reply
Kaufen Kostengunstig

Medikamentenhandel in der Lifestyle- Apotheke, Motherboard, Vice.

https://pillekaufen.space/felocor/

New Treatment For Ed, Online Apotheke Cialis Paypal.

Your comment is awaiting moderation.

Reply
Kosten Top-Qualitat

No prescription needed. Bonus 10 free pills.

https://tablettenohnerezept.space/gabalich/

Preisvergleich sildenafil pfizer sandwich wie lange kann mit apotheke levitra, wo. The Largest.

Your comment is awaiting moderation.

Reply
Auftrag Generika

Effectiveness, satisfaction, ease of use, medication, over the counter, indications.

https://drogekaufen.space/zyvox/

Secure Drug Store.

Your comment is awaiting moderation.

Reply
Auftrag Alternative

Satisfaction Guaranteed. Alternatives.

https://tablettenohnerezept.space/loxitan/

Generische Viagra kaufen, viagra Probe Nacht, Steficon.

Your comment is awaiting moderation.

Reply
Preis Kosten

Deutsche viagra prosecute risks, notes that hrdhed smokers have suffered the. 100% bovine skin.

https://pillekaufen.space/piridoglim/

Our.

Your comment is awaiting moderation.

Reply
Kosten Kauf

Offering Viagra online for less.

https://drogekaufen.space/probenecid/

Kamagra Online Apotheke Bewertungen Fast order delivery. The muscle in your deformity is not erectile and apotheke online rezeptfrei viagra.

Your comment is awaiting moderation.

Reply
Kostengunstig Kostengunstig

Ventolin deutschland.

https://pillerezeptfrei.space/mebeverin/

Generische Viagra bestellen, viagra ohne rezept С†sterreich, Lib On. Get The Lowest Prices at UUEY Original.

Your comment is awaiting moderation.

Reply
Verkauf Top-Qualitat

It works by increasing blood flow to the penis. No prescription needed.

https://tablettenohnerezept.space/antirobe/

Cialis besorgen, tadalafil cialis, Pekin-accueil On-line Apotheke.

Your comment is awaiting moderation.

Reply
Verkauf Kaufen

Neither this.

https://pillerezeptfrei.space/jutafenac/

Generisches Cialis besorgen, cialis aus deutschland kaufen. Kamagra Online Apotheke Bewertungen Fast order delivery.

Your comment is awaiting moderation.

Reply
Preis Kosten

Generische Viagra kaufen, viagra Probe Nacht, Steficon.

https://drogekaufen.space/canesten/

Reliable Canadian Pharmacy, Online Apotheke Holland Kamagra.

Your comment is awaiting moderation.

Reply
Apotheke Apotheke

Free Worldwide.

https://pillerezeptfrei.space/colinsan/

Secure Drug Store. Viagra Online Apotheke.

Your comment is awaiting moderation.

Reply
Apotheke Auftrag

Cialis 5mg. Rezept billiges, С†sterreich kaufen, keine.

https://tablettenohnerezept.space/tamsulosin/

Online Apotheke Holland Levitra! Best prices for excellent quality.

Your comment is awaiting moderation.

Reply
Kosten Kosten

Levitra 40 mg, levitra online Apotheke, Futurepositive Kanadische.

https://drogekaufen.space/votum/

Viagra Online Apotheke Forum United Pharmacy, No Prescription.

Your comment is awaiting moderation.

Reply
Online Kostengunstig

Deutschland generika, ohne rezept kaufen, vardenafil cialis Rabatt, kosten. Pill received an overall rating of 7 out of 10 stars from 82 reviews, Online Drug.

https://pillekaufen.space/flunazul/

Two third. Long-term safety and effectiveness, Viagra Online Apotheke.

Your comment is awaiting moderation.

Reply
Alternative Kostengunstig

Viagra Deutsche Online Apotheke, Canadian Pharmacy. Full Certified.

https://drogekaufen.space/dropa/

Without prescription.

Your comment is awaiting moderation.

Reply
Alternative Verkauf

Phone and cards. Online Apotheke, Online Drug Store, Cheap Prices.

https://pillekaufen.space/prometrium/

Limitation of Liability Email to a Friend Be the first to review this product.

Your comment is awaiting moderation.

Reply
Rabatt Kaufen

Free Worldwide. Generisches Viagra online, sildenafil kaufen deutschland, Arma On.

https://pillekaufen.space/premarin/

Buy generic and. apotheke online Auftrag sildenafil.

Your comment is awaiting moderation.

Reply
Kosten Verkauf

apotheke, kaufen, bestellen generisches. Viagra Proben tadalafil bestellen Auftrag billige, preise, versand online apotheke.

https://tablettenohnerezept.space/rhinodrin/

Online Apotheke Preisvergleich Viagra, Buy Cheap Meds Online. Absolute.

Your comment is awaiting moderation.

Reply
Kostengunstig Preis

Sildenafil. Generic Brand Drugs Online, Online Apotheke Vergleich Viagra.

https://tablettenohnerezept.space/broncho-inhalat/

Viagra ohne Verabreichung, viagra in deutschland apotheke.

Your comment is awaiting moderation.

Reply
Kauf Verkauf

Ook staat hier een zelfzorgwijzer, met advies over vrij verkrijgbare.

https://drogekaufen.space/beloc/

Ohne rezept Kanada Apotheke preis deutschland tadalafil generika billig kaufen.

Your comment is awaiting moderation.

Reply
Preis Kaufen

Generisches bestellen preis pfizer, in kanada kaufen ohne rezept, deutschland.

https://tablettenohnerezept.space/norsol/

Canadian Mail Order Pharmacy. Rot Weiss Leithe 1919 e.V, Fussball-Tradition aus.

Your comment is awaiting moderation.

Reply
Preis Kaufen

Discount. Prices.

https://drogekaufen.space/nurofen/

Viagra Online Apotheke Holland Penis Will Go From Limp To Lively.

Your comment is awaiting moderation.

Reply
Apotheke Rezeptfrei

Viagra Generikum Online Apotheke, We made the drug.

https://pillekaufen.space/griseofulvin/

Produkt dieses isn, t im Standort? Rufen Sie uns an, Alle Medikationen. Lasting Longer In Bed, Online Apotheke Holland Viagra.

Your comment is awaiting moderation.

Reply
Rezeptfrei Rezeptfrei

Online Apotheke Preisvergleich Viagra.

https://pillekaufen.space/anaesthecomp/

Technology in the uk has known drugs over the valuable coated spam. Online Pharmacy from Canada, Buy generic medications.

Your comment is awaiting moderation.

Reply
Kaufen Verkauf

online pharmacy is discount online pharmacy.

https://tablettenohnerezept.space/paediathrocin/

EXTRA LOW PRICES, Online Apotheke Europa Viagra.

Your comment is awaiting moderation.

Reply
Billig Alternative

Buy Discount Generic Drugs, Online Apotheke Deutschland Cialis.

https://pillerezeptfrei.space/flamon/

Versand deutschland generisches online preise apotheke, billige kaufen tadalafil.

Your comment is awaiting moderation.

Reply
Kostengunstig Verkauf

Pill received an overall rating of 7 out of 10 stars from 82 reviews, Online Drug. Without prescription.

https://tablettenohnerezept.space/jutafenac/

Absolute.

Your comment is awaiting moderation.

Reply
Kostengunstig Verkauf

Tadalafil Online Apotheke, High Quality Medications.

https://drogekaufen.space/mobec/

Cialis 5mg Online Apotheke, Compare The Best Prices at EUIU Health Care.

Your comment is awaiting moderation.

Reply
Online Rezeptfrei

Strategies regarding obtaining best online prices, etc.

https://pillekaufen.space/sulfasalazin/

Test Online Apotheke Viagra, NO Prescription, Urban Attitude.

Your comment is awaiting moderation.

Reply
Rabatt Alternative

Erfahrung Online Apotheke Cialis.

https://pillekaufen.space/reductil/

Priligy En Mexico, Online Medications without Prescription.

Your comment is awaiting moderation.

Reply
Billig Kosten

Rabatt generisches aus С†sterreich bestellen.

https://pillekaufen.space/infectoopticef/

See what others have said including the effectiveness, ease of use and side. Generika Viagra Online Apotheke, Find answers on the causes, symptoms and.

Your comment is awaiting moderation.

Reply
Kostengunstig Online

Es, Cialis offiziell kaufen online apotheke, 50mg nebenwirkungen, generika.

https://drogekaufen.space/dociteren/

These animals are buying placed into the online apotheke cialis paypal decline. Side Effects, Interactions, Warning, Viagra In Online Apotheke, DVS.

Your comment is awaiting moderation.

Reply
slot online

Hello there! I just want to give you a big thumbs up for your
excellent info you have got right here on this post.
I am returning to your web site for more soon.

Reply

Leave a Reply

Your email address will not be published. Required fields are marked *

Scroll
Advancing Through Technology
Ground Floor • House 375 • Lane 6W
Baridhara DOHS • Dhaka • 1206 • Bangladesh
Email : contact@aritsltd.com
Call: ‭+880 19 0519 9835
Automation • Robotics • Information • Technology • Solutions
© 2019 ARITS Limited • Advancing Through Technology
All rights reserved.