OS X Mavericks how to upgrade PHP from 5.4 to 5.5+?

I would tring to upgrade my php version to version 5.5+ latest

When I browse through / usr / local / bin / php -v in the console, I see version 5.5+, and with php -v it tells me that version 5.4 is installed.

How to remove the older version 5.4 and install the latest version 5.5+?

+4
source share
3 answers

I usually used the PHP package from liip.ch

From the terminal, run:

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

It will not remove the standard installation of PHP 5.4 from your system, but it will not affect the use of PHP 5.5. They solve the problem using php -vthe FAQ .

+11
source

Background

Xcode ( ) gcc php libjpeg, libpng .., .

xcode-select --install

php:

  • www.php.net/downloads.php
  • .
  • , php, php -i | . php , pcre, .
  • php, , . /configure script
  • php, make sudo make install . php, OS X.

:

tar -zxvf php_scource.tar.gz
cd php_source/
php -i | head
./configure --prefix=/usr --with-snmp # ... same flags as previous build
make
sudo make install

php

$ php -v

php -v

PHP 5.5.10 (cli) (built: Mar 27 2014 16:50:31) 
Copyright (c) 1997-2014 The PHP Group
Zend Engine v2.5.0, Copyright (c) 1998-2014 Zend Technologies
+5

OSX Mavericks PHP /usr/bin/php, /usr/local/bin/php /usr/bin. php, /usr/bin

cd /usr/bin

php

sudo mv php php.old

/usr/bin/local:

cd /usr/local/bin

php /usr/bin, sudo:

sudo cp php /usr/bin

OSX Mavericks /usr/bin , php /usr/bin , php /usr/local/bin. php,

php -v

:

PHP 5.6.23 (cli) (built: Jun 24 2016 21:08:07) 
Copyright (c) 1997-2016 The PHP Group
Zend Engine v2.6.0, Copyright (c) 1998-2016 Zend Technologies

You will have a new version that was installed in / usr / local / bin / php, which you copied to / usr / bin / php instead of version 5.4. If you are using Apache and want your web server to also use the new php version, you will also need to update the httpd.conf file to point to the new php_module, but that is another question.

0
source

Source: https://habr.com/ru/post/1533713/


All Articles