Yet Another Consultant

Web Fireman, Consultant, Photographer, Father, ...
... Roaming in the IT World

Today I started to dig into the tons of unread mails I received this month. My first priority was to fix 2 formulas I've submitted to the homebrew project (one is for the eZ Components, the other one to be able to install php-intl which is a requirement for Symfony2 developments).

But, I discovered that homebrew people decided to stop maintaining PHP formulas in the main repository. They are not PHP developers and can't have a good sight on what they review and pull. Well, homebrew-php is the new repository to PHP-related formulas and adamv told me that multi-repositories management will be handled in a short term. So that's quite a good news !

Before doing anything regarding the formulas I've submitted, I was curious to install PHP 5.3.10 using homebrew and see how it works. This blog post is about that.


Install homebrew
Say a prayer 

Installing PHP 5.3.10

Since PHP are not handler in the homebrew default repository you need to explicitly give the path to the formula you wan to install. In my case, I have a local clone of homebrew-php so I can simply do this :

$ brew install ~/Development/git-clones/homebrew-php/Formula/php.rb

As we can see in the formula code, the installer supports a few options :

 ['--with-mysql', 'Include MySQL support'],
 ['--with-mariadb', 'Include MariaDB support'],
 ['--with-pgsql', 'Include PostgreSQL support'],
 ['--with-mssql', 'Include MSSQL-DB support'],
 ['--with-unixodbc', 'Include unixODBC support'],
 ['--with-cgi', 'Enable building of the CGI executable (implies --without-apache)'],
 ['--with-fpm', 'Enable building of the fpm SAPI executable (implies --without-apache)'],
 ['--without-apache', 'Build without shared Apache 2.0 Handler module'],
 ['--with-intl', 'Include internationalization support'],
 ['--with-imap', 'Include IMAP extension'],
 ['--without-readline', 'Build without readline support'],
 ['--with-gmp', 'Include GMP support'],
 ['--with-suhosin', 'Include Suhosin patch']

As far as I'm concerned, I've installed it with mysql and suhosin support.

$ brew install ~/Development/git-clones/homebrew-php/Formula/php.rb --with-mysql --with-suhosin

Using the newly installed PHP in your Apache configuration

Simply edit your default configuration file in /etc/apache2/httpd.conf, find the line regarding php5_module and change the path to the .so file

LoadModule php5_module /usr/local/Cellar/php/5.3.10/libexec/apache2/

Getting your built-in Mac OS X PHP configuration back

You might have noticed that the configuration file now used by your php installation is not the one located in /private/etc/php.ini anymore. Just compare what you had in that file and report it in the one used by the homebrew version (which is in /usr/local/etc/php.ini)

What about the command line ?

If you want to use the 5.3.10 version of your freshly installed PHP-CLI, then you need to use /usr/local/bin/php

$ php -v
PHP 5.3.8 with Suhosin-Patch (cli) (built: Nov 15 2011 15:33:15) 
Copyright (c) 1997-2011 The PHP Group
Zend Engine v2.3.0, Copyright (c) 1998-2011 Zend Technologies
$ /usr/local/bin/php -v
PHP 5.3.10 with Suhosin-Patch (cli) (built: Mar 7 2012 18:14:58) 
Copyright (c) 1997-2012 The PHP Group
Zend Engine v2.3.0, Copyright (c) 1998-2012 Zend Technologies

Developing on eZ Publish ?

If using eZ Publish, here's the checklist :

  • php.ini : check your include_path if you have a shared installation for your ezcomponents
  • php.ini : check your memory_limit value if you have to work on a $%@ project that requires more than the default 128 Mo in development mode
  • php.ini : check display_errors, html_errors, etc...

Tags: eZ Publish eZ Publish , Github Github , homebrew homebrew , Mac OS X Mac OS X , PHP PHP

blog comments powered by Disqus

About me

7 years, roaming in the IT world, working on different project sizes, different project types and using a lot of technologies and solutions that are usually used on LAMP projects.

My last job at eZ Systems  (the company behind eZ Publish) as Technical Accounter Manager and Senior Consultant, was very formative since it gave me the opportunity to work for prestigious and high-end customers

I can now operate as a freelance for both customers and IT companies, always keeping in mind everybody's needs.

Get in touch with me using this form .

Arnaud Lafon is eZ Publish Community Partner