在MAC上升级到PHP 5.4并删除版本5.3.10

编程入门 行业动态 更新时间:2024-10-28 12:27:20
本文介绍了在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年初,您最好从 php-osx.liip.ch/的安装版本进行安装包含大多数扩展名.如果确实需要自己编译,请遵循原始答案.

Update: As of early 2014, you are probably better of installing from 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/downloads.php下载发行版
  • 解压缩存档并将控制台指向该位置
  • 现在,仍然安装了原始的旧php,在控制台中运行php -i | head.您想要的是使用这些标志配置新的php,以确保您具有适当的pcre支持,并且一切正常.
  • 在您解开的php源目录中,使用您刚获得的标志运行./configure脚本
  • 随后运行make和sudo make install来构建php.实际上,这将取代OS X发行的原始php.
  • Download the distribution from www.php/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 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

本文发布于:2023-11-02 03:26:47,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1551242.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:升级到   版本   PHP   MAC

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!