Apache Lounge


About Forum Index Downloads Search Register Log in  RSS Apache Lounge  

Keep Server Online

If you find the Apache Lounge, the downloads and overall help useful, please express your satisfaction with a donation.



A donation makes a contribution towards the costs, the time and effort that's going in this site and building.

Thank You! Steffen

Your donations will help to keep this site alive and well, and continuing building binaries. Apache Lounge is not sponsored.

Post new topic   Forum Index -> Other Software View previous topic :: View next topic
Reply to topic   Topic: How to change Apache PHP version (installed with homebrew)

Joined: 02 Nov 2016
Posts: 1
Location: UK, London

PostPosted: Wed 02 Nov '16 18:27    Post subject: How to change Apache PHP version (installed with homebrew) Reply with quote

I have installed php version 5.4 using homebrew (brew install homebrew/php/php54) and I can now use this version on the command line ok, which overrides the default installed version 5.5 which comes with OSX El-Capitan. Now I need to modify the apache config so that it too now runs 5.4 and not 5.5.38.

Now, established wisdom says that I should be modifying /private/etc/apache2/httpd.conf. So the line under question is:

169 LoadModule php5_module libexec/apache2/libphp5.so

but that libphp5.so, is rather general and doesn't look specific to either 5.4 or 5.5.

In another article I found https://www.euperia.com/development/using-different-php-versions-osx-apache-homebrew/1441

the httpd.conf file looks like this, where the appropriate line can be left uncommented according to specific php version you require for apache:
120 # LoadModule php5_module libexec/apache2/libphp5.so
121 # LoadModule php5_module /usr/local/Cellar/php53/5.3.29/libexec/apache2/libphp5.so
122 LoadModule php5_module /usr/local/Cellar/php54/5.4.36/libexec/apache2/libphp5.so
123 # LoadModule php5_module /usr/local/Cellar/php55/5.5.20/libexec/apache2/libphp5.so
124 # LoadModule php5_module /usr/local/Cellar/php56/5.6.4/libexec/apache2/libphp5.so

My installation of php54 by homebrew is located at /usr/local/Cellar/php54/5.4.45_6/ and when I run php --version I see:

$ php --version
PHP 5.4.45 (cli) (built: Oct 1 2016 22:20:59)
Copyright (c) 1997-2014 The PHP Group
Zend Engine v2.4.0, Copyright (c) 1998-2014 Zend Technologies

Under /usr/local/Cellar/php54/5.4.45_6/, I can't find any reference to libphp5.so so that I can configure an absolute path to it (so essentially, under ../5.445_6/ I can't see a libexec/.. which I'm expecting somewhere to contain a libphp5.so that can be referenced).

As a quick test, I configured it with /usr/local/Cellar/php54/5.4.45_6/libexec/apache2/libphp5.so, but since this file does exist, apache failed to start.

So my question clearly is, how do I find the correct path to the 5.4 version of PHP, so that I can configure apache to load the module correctly on start up, thanks.
Back to top
James Blond

Joined: 19 Jan 2006
Posts: 6822
Location: Germany, Next to Hamburg

PostPosted: Sat 12 Nov '16 22:50    Post subject: Reply with quote

You better ask in a forum for Mac OS X. Here are mostly windows users Wink
Back to top

Joined: 15 Apr 2012
Posts: 205
Location: Denver, CO USA

PostPosted: Sun 13 Nov '16 4:44    Post subject: Reply with quote

When I used to run Apache on my MAC using XAMPP, this is what I used to update my PHP. Not sure if it will work with HomeBrew, but might be worth a look.


Back to top

Reply to topic   Topic: How to change Apache PHP version (installed with homebrew) View previous topic :: View next topic
Post new topic   Forum Index -> Other Software