我如何在Mac OS X Lion上安装php 5.4?

Moh*_*san 26 php macos

我从php.net下载了php 5.4.0 ,我想在mac os X lion上升级它.

我也想问一下是否有人知道如何升级apache.

提前致谢.


嗨我已安装它但我不知道如何使用httpd.conf配置它

 /usr/local/bin/php -v
PHP 5.4.0 (cli) (built: Mar  3 2012 02:41:24) 
Copyright (c) 1997-2012 The PHP Group
Zend Engine v2.4.0, Copyright (c) 1998-2012 Zend Technologies
Run Code Online (Sandbox Code Playgroud)

我试着将它添加到httpd.conf

正如它所说,但Web服务器不想启动

LoadModule php5_module libexec/libphp5.so
Run Code Online (Sandbox Code Playgroud)

小智 24

我发表了关于如何将本地PHP安装升级到5.4的博文.

归档内容包含外部站点故障:

Now let’s upgrade PHP in a few steps:

1. Download and unpack the PHP source archive
2. Install following packages using brew: libjpeg and pcre
3. Change directory to the source archive of PHP
4. Use the configure command to prepare the compilation process:

./configure  \
--prefix=/usr  \
--mandir=/usr/share/man  \
--infodir=/usr/share/info  \
--sysconfdir=/private/etc  \
--with-apxs2=/usr/sbin/apxs  \
--enable-cli  \
--with-config-file-path=/etc  \
--with-libxml-dir=/usr  \
--with-openssl=/usr  \
--with-kerberos=/usr  \
--with-zlib=/usr  \
--enable-bcmath  \
--with-bz2=/usr  \
--enable-calendar  \
--with-curl=/usr  \
--enable-dba  \
--enable-exif  \
--enable-ftp  \
--with-gd  \
--enable-gd-native-ttf  \
--with-icu-dir=/usr  \
--with-iodbc=/usr  \
--with-ldap=/usr  \
--with-ldap-sasl=/usr  \
--with-libedit=/usr  \
--enable-mbstring  \
--enable-mbregex  \
--with-mysql=mysqlnd  \
--with-mysqli=mysqlnd  \
--without-pear  \
--with-pdo-mysql=mysqlnd  \
--with-mysql-sock=/var/mysql/mysql.sock  \
--with-readline=/usr  \
--enable-shmop  \
--with-snmp=/usr  \
--enable-soap  \
--enable-sockets  \
--enable-sysvmsg  \
--enable-sysvsem  \
--enable-sysvshm  \
--with-tidy  \
--enable-wddx  \
--with-xmlrpc  \
--with-iconv-dir=/usr  \
--with-xsl=/usr  \
--enable-zip  \
--with-pcre-regex  \
--with-pgsql=/usr  \
--with-pdo-pgsql=/usr \
--with-freetype-dir=/usr/X11 \
--with-jpeg-dir=/usr  \
--with-png-dir=/usr/X11     
Run Code Online (Sandbox Code Playgroud)

而已.成功配置后,使用'make test'检查您的编译和'sudo make install'以实际安装新版本.

  • 这个链接好像坏了! (4认同)

Chu*_* Ma 20

使用MacPorts,

  sudo port install php54 
Run Code Online (Sandbox Code Playgroud)

以上将在/ opt/local/bin/php54中安装php54.

/etc] php54 -v
PHP 5.4.8 (cli) (built: Oct 19 2012 11:30:15) 
Copyright (c) 1997-2012 The PHP Group
Zend Engine v2.4.0, Copyright (c) 1998-2012 Zend Technologies
    with Xdebug v2.2.1, Copyright (c) 2002-2012, by Derick Rethans
Run Code Online (Sandbox Code Playgroud)

您可以安装自己喜欢的其他模块.例如,我经常使用memcache和apc.请执行下列操作:

  sudo port install php54-memcache php54-apc
Run Code Online (Sandbox Code Playgroud)

对于您可能想要添加的其他php54模块,您可以使用以下命令找到它们:

  port search php54
Run Code Online (Sandbox Code Playgroud)

我做了以下以使其成为我的默认php

  sudo port select php php54
Run Code Online (Sandbox Code Playgroud)

  • 我不得不重启我的终端,以便在`sudo port select php php54`之后使用正确的php.HTH. (3认同)

Lei*_*igh 14

编辑:

不要这样做了.现在MacPorts上有一个php54端口.


所以只是为了好玩,我通过Macports试了一下.

Macports仍然在PHP 5.3.10上,所以我编辑了Portfile.

$ cd /opt/local/var/macports/sources/rsync.macports.org/release/tarballs/ports/lang/php5
$ sudo vi Portfile
Run Code Online (Sandbox Code Playgroud)

更改:

version -> 5.4.0
autoconf213 -> autoconf
checksums -> rmd160 7842f4f2b0aa064e10c82b5702cb8333bcb97f24
Run Code Online (Sandbox Code Playgroud)

在我改变后,我跑了:

$ sudo port install php5
...
$ php -v
...
PHP 5.4.0 (cli) (built: Mar  2 2012 15:02:14) 
Copyright (c) 1997-2012 The PHP Group
Zend Engine v2.4.0, Copyright (c) 1998-2012 Zend Technologies
Run Code Online (Sandbox Code Playgroud)

它似乎打破了一些模块路径,但我确信这是一个简单的解决方案.

编辑: 通过进入各自的portfiles,更改PHP版本和校验和,并重新安装来修复损坏的模块.


Eri*_*itz 10

我真的很想推荐这个解决方案http://php-osx.liip.ch/