在MAC上升级到PHP 5.4并删除版本5.3.10 [英] Upgrade to PHP 5.4 on MAC and remove version 5.3.10

查看:61
本文介绍了在MAC上升级到PHP 5.4并删除版本5.3.10的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想将我的php版本更新为5.4版本.

I would tring to update my php version to the version 5.4.

当我在控制台中通过/usr/local/bin/php -v查看时,我看到了5.4.3版本,而使用php -v时,它告诉我已经安装了5.3.10版本.

When I'm looking via /usr/local/bin/php -v in the console I see the version 5.4.3 and with php -v it tell me there is the version 5.3.10 installed.

如何删除较旧的版本?

推荐答案

更新: 截至2014年初,您最好从 http://php-osx.liip.ch/的安装版本进行安装包含大多数扩展名.如果确实需要自己编译,请遵循原始答案.

Update: As of early 2014, you are probably better of installing from http://php-osx.liip.ch/ builds as it contains most extensions. In case you really do need to compile your own, follow the original answer.

原始答案:

Mac随附了一个预安装的php,您可以轻松覆盖它.

Mac comes with a preinstalled php you can easily overwrite.

这是我用来更新已安装的php的步骤的列表:

This is a list of steps I take to update the php I have installed:

先决条件:

  • Xcode及其命令行实用程序(安装表单首选项)将为您提供一个gcc编译器,用于使用
  • libjpeg,libpng等.如果要使用它们构建.

构建和安装php:

  • 从www.php.net/downloads.php下载发行版
  • 解压缩存档并将控制台指向该位置
  • 现在,仍然安装了原始的旧php,在控制台中运行php -i | head.您想要的是使用这些标志配置新的php,以确保您具有适当的pcre支持,并且一切正常.
  • 在您解开的php源目录中,使用您刚获得的标志运行./configure脚本
  • 随后运行makesudo make install来构建php.实际上,这将取代OS X发行的原始php.
  • Download the distribution from www.php.net/downloads.php
  • Untar the archive and point your console into the location
  • Now, having still the original old php installed, run php -i | head in the console. What you want is to configure your new php with these flags to ensure you have proper pcre support and everything works just fine.
  • In the php source directory you untarred, run the ./configure script with the flags you just got
  • Build php by running make and sudo make install afterwards. That will actually replace the original php distributed with OS X.

别忘了运行make test ...

例如:我构建php的工作流程

Ex.: my workflow for building php

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

这篇关于在MAC上升级到PHP 5.4并删除版本5.3.10的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆