Upgrade to PHP5.5 with brew on top of your old PHP5.4

So I had some problems installing php55 on my mac and here is the summary of the solution because if you are not working on php55 you are missing on stuff:

My machine had php54 but this one other had php53 from somewhere:

➜  ~  php --version
PHP 5.3.15 with Suhosin-Patch (cli) (built: Dec  9 2012 19:32:02) 
Copyright (c) 1997-2012 The PHP Group
Zend Engine v2.3.0, Copyright (c) 1998-2012 Zend Technologies

I started to update and upgrade the formulas. You should have josegonzales tapped on your brew and even till/till too i think for those using tidy library:

➜  ~  brew update
➜  ~  brew upgrade

If you have php54 installed before you would need to remove it before proceeding:

➜  ~  brew remove php54
➜  ~  brew install php55

You should get something like:

Warning: Could not link php55. Unlinking...
Error: The `brew link` step did not complete successfully
The formula built, but is not symlinked into /usr/local
You can try again using `brew link php55'

Then after trying this:

➜  ~  brew link php55   
Linking /usr/local/Cellar/php55/5.5.1... Warning: Could not link php55. Unlinking...
Error: Could not symlink file: /usr/local/Cellar/php55/5.5.1/bin/phpize
Target /usr/local/bin/phpize already exists. You may need to delete it.
To force the link and overwrite all other conflicting files, do:
  brew link --overwrite formula_name
To list all files that would be deleted:
  brew link --overwrite --dry-run formula_name

If you have problems because of the symlinks php54 created to the bin executable folders you may need to sudo rm some of the links as brew will tell you which to remove. Just follow the instructions to do this and do:

➜  ~  sudo rm /usr/local/bin/phpize 
➜  ~  brew link --overwrite --dry-run php55

And it works:

➜  ~  brew link --override php55
Linking /usr/local/Cellar/php55/5.5.1... 486 symlinks created
➜  ~  chmod -R ug+w /usr/local/Cellar/php55/5.5.1/lib/php
➜  ~  pear config-set php_ini /usr/local/etc/php/5.5/php.ini

Make sure your ~/.batch_profile or other contains:

 PATH="$(brew --prefix josegonzalez/php/php55)/bin:$PATH"
➜  ~  sudo pico ~/.bash_profile
➜  ~  source ~/.bash_profile 
➜  ~  php --version
PHP 5.5.1 (cli) (built: Aug  9 2013 12:19:47) 
Copyright (c) 1997-2013 The PHP Group
Zend Engine v2.5.0, Copyright (c) 1998-2013 Zend Technologies

Hope you are now php55 ready! Encouragements and as always please check and support me by buying the Lean Book on Symfony2 Ecommerce I am writing! Thanks again!

Undeservedly glad, your friend @cordoval.

2 thoughts on “Upgrade to PHP5.5 with brew on top of your old PHP5.4

  1. Hi. Thank you for great manual. One little remark:
    “brew link –override php55” didn’t work for me, so I used “brew link –overwrite php55” and that worked.

Leave a Reply

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