Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to update PHP CLI OSX?

I just updated to php 5.4 using http://php-osx.liip.ch/ on osx lion.

when i type:

php -v

i still see:

PHP 5.3.15 with Suhosin-Patch (cli) (built: Jul 31 2012 14:49:18) 
Copyright (c) 1997-2012 The PHP Group
Zend Engine v2.3.0, Copyright (c) 1998-2012 Zend Technologies

But phpinfo() shows 5.4.

How do i update this?

like image 388
user1168427 Avatar asked Mar 10 '13 19:03

user1168427


3 Answers

Just Export installed PHP path ,type this on Terminal

export PATH=/usr/local/php5/bin:$PATH
like image 69
Chutipong Roobklom Avatar answered Nov 06 '22 20:11

Chutipong Roobklom


I checked that /usr/local/php5/bin/php existed. It did, so I added /usr/local/php5/bin to my PATH.

Thank you @AD7six

like image 42
user1168427 Avatar answered Nov 06 '22 21:11

user1168427


The answer shared by both Chutipong Roobklom and user1168427 helped, if you want to update to the latest php cli which is 7.2.7 (most current and stable release as of 2018 when this post was created originally so check the latest php version, methods for switching versions may vary) then just use this instead of the php5 command. export PATH=/usr/local/php7/bin:$PATH then type php -v and you should have something that reads like this(on MACOSX by the way):

PHP 7.2.7 (cli) (built: Jun 22 2018 06:27:50) ( NTS ) Copyright (c) 1997-2018 The PHP Group Zend Engine v3.2.0, Copyright (c) 1998-2018 Zend Technologies with Zend OPcache v7.2.7, Copyright (c) 1999-2018, by Zend Technologies

so you shouldn't be getting any errors. Hope this helps and for Kamel, that is how it is installed. You're kind of 'exposing' it in a way for your machine to now recognize which php version you are using.

like image 37
DevOpsIsTheNameOfTheGame Avatar answered Nov 06 '22 21:11

DevOpsIsTheNameOfTheGame