0

I am on my Mac OS X Mojave. I don't know why my PHP has diff versions.

php --version , I got

PHP 7.1.4 (cli) (built: May  6 2017 10:02:00) ( NTS )                            
Copyright (c) 1997-2017 The PHP Group                                            
Zend Engine v3.1.0, Copyright (c) 1998-2017 Zend Technologies                    
    with Zend OPcache v7.1.4, Copyright (c) 1999-2017, by Zend Technologies      

which php, I got

/usr/local/php5/bin/php                                                          

php -i | grep php.ini, I got

Configuration File (php.ini) Path => /usr/local/php5/lib                        
Loaded Configuration File => /usr/local/php5/lib/php.ini 

printenv, I got

TERM=xterm-256color
SHELL=/bin/bash
CLICOLOR=1
TMPDIR=/var/folders/54/y_678c6n7q7_pgk1v5lkzwnr0000gp/T/
SSH_CLIENT=10.20.100.88 49732 22
OLDPWD=/Users/bheng
SSH_TTY=/dev/ttys016
USER=bheng
LSCOLORS=ExFxBxDxCxegedabagacad
MAIL=/var/mail/bheng
PATH=/Library/Frameworks/Python.framework/Versions/3.6/bin:/usr/local/opt/curl/bin:/Applications/Postgres.app/Contents/Versions/latest/bin:/Library/Frameworks/Python.framework/Versions/2.7/bin:/usr/local/sbin:/usr/local/php5/bin:/Users/bheng/.composer/vendor/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/pgsql/bin:/opt/X11/bin:/Applications/Wireshark.app/Contents/MacOS:/usr/local/mysql/bin
PWD=/Users/bheng/Desktop
SHLVL=1
HOME=/Users/bheng
GREP_OPTIONS=--color=always
LOGNAME=bheng
SSH_CONNECTION=10.20.100.88 49732 10.20.100.88 22
_=/usr/bin/printenv

When I open up php.info I see this

enter image description here

  • What PHP version do I have exactly? 7 or 5 ? or both?
  • Should we only keep only one PHP version on our Mac OS X?
  • How do we know which one to keep?
  • How do we safely remove the one we don't need?

Someone, please shed some light on this confusion.

code-8
  • 54,650
  • 106
  • 352
  • 604
  • You have both. Keep both if you plan on working with code that was created with 5.6. Otherwise, delete the old and keep the new. – aynber Jan 03 '19 at 18:31
  • I have a lot of Laravel projects on my Mac OS X, that will require PHP 5, and 7. – code-8 Jan 03 '19 at 18:32
  • Then keep both. It won't cause any issues, other than confusion of which PHP you're currently using. – aynber Jan 03 '19 at 18:33
  • so how do I know which project which PHP 7 which project use my PHP 5 ? – code-8 Jan 03 '19 at 18:35
  • Should I ignore the result of `which php` command then ? – code-8 Jan 03 '19 at 18:36
  • 1
    `which` is more for the command line. You'll probably need to create aliases for each for the command-line portion. For Apache, I'd suggest looking at https://stackoverflow.com/questions/42696856/running-two-php-versions-on-the-same-server to be able to specify which PHP version you're using on each project. – aynber Jan 03 '19 at 18:37
  • How was the additional (non-default) version of `PHP` installed? Depending on how it was done there are relatively simple ways to switch between two versions. – l'L'l Jan 03 '19 at 20:08
  • Possible duplicate of [Mcrypt PHP extension required on Mac OS X Mojave](https://stackoverflow.com/questions/54028143/mcrypt-php-extension-required-on-mac-os-x-mojave) – common sense Jan 04 '19 at 11:51

0 Answers0