How do I upgrade PHP in Mac OS X?

前端 未结 13 810
暖寄归人
暖寄归人 2020-12-12 13:34

I feel this is an awfully obtuse question to ask, but strangely, this problem is poorly documented.

I would like to upgrade PHP, but there are several problems:

13条回答
  •  误落风尘
    2020-12-12 14:07

    I think one simple way to do it, is:

    1 - Check you where is your current PHP:

    $ which php
    $ /usr/local/bin/php
    

    You see? Usually, our commands that we run is a link in /usr/local/bin so...

    2 - Unlink this current link of PHP

    unlink /usr/local/bin/php
    

    If you prefere, before unlink it, check the path and then remove php files (do ls -al /usr/local/bin | grep php and then rm -rf into desired path)

    3 - Install PHP 7.1

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

    4 - Create new link (using php 7.1 bin that you have installed)

    ln /usr/local/php5-7.1.9-20170914-100859/bin/php /usr/local/bin/php
    

    Like I said, its a simple way I think.

提交回复
热议问题