$ php -v
PHP 5.5.24 (cli) (built: May 19 2015 10:10:05) 
Copyright (c) 1997-2015 The PHP Group
Zend Engine v2.5.0, Copyright (c) 1998-2015 Zend Technologies
    with Xdebug v2.2.3, Copyright (c) 2002-2013, by Derick Rethans

$ which php

And the php.ini?

$ php -i | grep "php.ini"
Configuration File (php.ini) Path => /etc
Loaded Configuration File => /etc/php.ini

*** If you dont have the php.ini into the /etc . search for php.ini.default . Copy that file with the file name php.ini
So you can change the configuration on that php.ini file to change php configuration in your system 

Upgrade PHP ? 

$ curl -s http://php-osx.liip.ch/install.sh | bash -s 5.6 

You can change the version number to 7.0 (stable php version 7.0.7)

$ sudo vi ~/.bash_profile
write the line export PATH=/usr/local/php5/bin:$PATH 
Save the file 

$ source ~/.bash_profile
$ sudo apachectl restart
$ which php

$ php -v

You will see the updated  php version .

New php.ini path is /usr/local/php5/lib/ . You can configure your php settings from that php.ini file . Dont forget to use $ sudo apachectl restart
after you made php.ini changes . 

php -r 'echo phpinfo();'

// Show php configuration 

Note : This way you can upgrade your cli based php version . If you want to upgrade your MAMP or XAMP you have to use different procedure . 

You have updated your Mac OsX built-in PHP.

how to upgrade your php version in OSX ?
Tagged on:                         

Leave a Reply

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