4

I've installed in my osX php7 from homebrew, however when I type in the shell eitherphp --version or php-fpm --version I get as result an older version

PHP 5.5.30 (fpm-fcgi) (built: Oct 23 2015 17:22:03) Copyright (c) 1997-2015 The PHP Group Zend Engine v2.5.0, Copyright (c) 1998-2015 Zend Technologies

From the shell I looked for every php file or folder sudo find / -name "php" but nothing linked to PHP 5.5

What should I do?

Mitro
  • 1,230
  • 8
  • 32
  • 61
  • maybe you have more than one version installed –  Jan 30 '16 at 01:31
  • 1
    1) Call a `phpinfo()` in a php page and open-it in browser. BTW, The 3rd part releases of php don't replace default php installation. You have to call-it directly or add setting. See [this question](http://stackoverflow.com/questions/20523183/how-to-use-the-php-that-brew-installed) or - if it's don't work on your osx version - google-it something like 'php homebrew osx default' – fusion3k Jan 30 '16 at 01:32
  • @AlessioMTX Maybe one of this can help-you: https://goo.gl/0YQrtu https://goo.gl/dvA4MI – fusion3k Jan 30 '16 at 01:36
  • phpinfo() shows 5.5.30, that is the dafault version installed in mac osx el capitan. Moreover, I use nginx, not apache – Mitro Jan 30 '16 at 01:40
  • Most likely because the homebrew php is not in your bath. Use can add it in your `~/.bash_profile` (or whatever shell you use, bash is default on Mac). Add this to the end: `export /usr/local/Cellar/php7/bin:$PATH` change the path to whatever is in your system. – Michael Jan 30 '16 at 02:12
  • export /path/that/need : not a valid identifier after source ~/.base_profile – Mitro Jan 31 '16 at 14:49

1 Answers1

6

After creating ~/.bash.profile as written in comments by Michael, I found the solution thanks to change the PHP path to MAMPs PHP

In ~/.bash_profile I wrote:

export PATH=/usr/local/Cellar/php70/7.0.2/bin:$PATH
export PATH=/usr/local/Cellar/php70/7.0.2/sbin:$PATH

First row is for php, the second for php-fpm

Then, to be sure that changes take effect type in terminal source ~/.bash_profile

Community
  • 1
  • 1
Mitro
  • 1,230
  • 8
  • 32
  • 61