簡體   English   中英

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

[英]how do i install php 5.4 on Mac OS X Lion?

我從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

我試着將它添加到httpd.conf

正如它所說,但Web服務器不想啟動

LoadModule php5_module libexec/libphp5.so

我發表了關於如何將本地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 

而已。 成功配置后,使用'make test'檢查您的編譯和'sudo make install'以實際安裝新版本。

使用MacPorts,

  sudo port install php54 

以上將在/ 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

您可以安裝自己喜歡的其他模塊。 例如,我經常使用memcache和apc。 請執行下列操作:

  sudo port install php54-memcache php54-apc

對於您可能想要添加的其他php54模塊,您可以使用以下命令找到它們:

  port search php54

我做了以下以使其成為我的默認php

  sudo port select php php54

編輯:

不要這樣做了。 現在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

更改:

version -> 5.4.0
autoconf213 -> autoconf
checksums -> rmd160 7842f4f2b0aa064e10c82b5702cb8333bcb97f24

在我改變后,我跑了:

$ 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

它似乎打破了一些模塊路徑,但我確信這是一個簡單的解決方案。

編輯:通過進入各自的portfiles,更改PHP版本和校驗和,並重新安裝來修復損壞的模塊。

我真的很想推薦這個解決方案http://php-osx.liip.ch/

如果你使用Homebrew這個公式非常方便: https//github.com/josegonzalez/homebrew-php

@ memoryleak的博客文章看起來很不錯。 但是,我正在尋找有關如何在ML上安裝LAMP堆棧的資源我從diymacserver找到了這個指南 ,看起來相當廣泛。 一個樣品:

以下是在運行Lion的Intel Mac上安裝,配置和啟動MAMP堆棧的說明。 請注意,這些說明不適用於OS的服務器版本。

它包括以下內容:

  • 安裝MySQL
  • 保護MySQL安裝
  • 自動啟動MySQL
  • 安裝Apache
  • 編譯Apache
  • 配置Apache
  • 自動啟動Apache
  • 使用Apache配置虛擬主機
  • 使用虛擬主機配置HTTPS
  • 編譯PHP
  • 將GD模塊添加到PHP
  • 將mcrypt模塊添加到PHP
  • 最新測試版本
  • 升級MySQL

我很高興現在在ML上安裝64位燈堆。

如果您在PCRE中缺少UTF-8支持,請在安裝PHP 5.4后,仔細檢查/ usr / lib中是否有舊的8.02 pcre lib文件,如@memoryleak建議的那樣。 這個提示今天會節省我幾個小時。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM