手机浏览 RSS 2.0 订阅 膘叔的简单人生 , 腾讯云RDS购买 | 超便宜的Vultr , 注册 | 登陆
浏览模式: 标准 | 列表2013年04月16日的文章

mac下面安装php5.4

 苹果下面安装php5.4还算是比较方便的,主要是默认为php5.3,想用trait的时候,没5.4跑不了啊。。

于是直接使用brew install php54,结果报错,查了下资料,原来,需要:

  • brew tap josegonzalez/homebrew-php
  • brew tap homebrew/dupes 
  • brew install php54 --with-mysql --with-intl --with-fpm --without-apache 

因为有装nginx。所以就without-apache了。。。

安装好后,brew 会告诉你:

XML/HTML代码
  1. The php.ini file can be found in:  
  2.     /usr/local/etc/php/5.4/php.ini  
  3.   
  4. ✩✩✩✩ PEAR ✩✩✩✩  
  5.   
  6. If PEAR complains about permissions, 'fix' the default PEAR permissions and config:  
  7.     chmod -R ug+w /usr/local/Cellar/php54/5.4.13/lib/php  
  8.     pear config-set php_ini /usr/local/etc/php/5.4/php.ini  
  9.   
  10. ✩✩✩✩ Extensions ✩✩✩✩  
  11.   
  12. If you are having issues with custom extension compiling, ensure that this php is  
  13. in your PATH:  
  14.     PATH="$(brew --prefix josegonzalez/php/php54)/bin:$PATH"  
  15.   
  16. PHP54 Extensions will always be compiled against this PHP. Please install them  
  17. using --without-homebrew-php to enable compiling against system PHP.  
  18.   
  19. ✩✩✩✩✩ INTL Support ✩✩✩✩✩  
  20.   
  21. icu4c is broken as of mxcl/homebrew#03ed757c, so you will need to install intl as  
  22. a separate extension:  
  23.   
  24.     brew install php54-intl  
  25.   
  26. ✩✩✩✩ FPM ✩✩✩✩  
  27.   
  28. To launch php-fpm on startup:  
  29.     * If this is your first install:  
  30.         mkdir -p ~/Library/LaunchAgents  
  31.         cp /usr/local/Cellar/php54/5.4.13/homebrew-php.josegonzalez.php54.plist ~/Library/LaunchAgents/  
  32.         launchctl load -w ~/Library/LaunchAgents/homebrew-php.josegonzalez.php54.plist  
  33.   
  34.     * If this is an upgrade and you already have the homebrew-php.josegonzalez.php54.plist loaded:  
  35.         launchctl unload -w ~/Library/LaunchAgents/homebrew-php.josegonzalez.php54.plist  
  36.         cp /usr/local/Cellar/php54/5.4.13/homebrew-php.josegonzalez.php54.plist ~/Library/LaunchAgents/  
  37.         launchctl load -w ~/Library/LaunchAgents/homebrew-php.josegonzalez.php54.plist  
  38.   
  39. The control script is located at /usr/local/Cellar/php54/5.4.13/sbin/php54-fpm  
  40.   
  41. Mountain Lion comes with php-fpm pre-installed, to ensure you are using the brew version you need to make sure /sbin is before /usr/sbin in your PATH:  
  42.   
  43.   PATH="/sbin:$PATH"  
  44.   
  45. You may also need to edit the plist to use the correct "UserName".  
  46.   
  47. Please note that the plist was called 'org.php-fpm.plist' in old versions  
  48. of this formula.  
  49.   
  50. To have launchd start php54 at login:  
  51.     ln -sfv /usr/local/opt/php54/*.plist ~/Library/LaunchAgents  
  52. Then to load php54 now:  
  53.     launchctl load ~/Library/LaunchAgents/homebrew.mxcl.php54.plist  
  54. Warning: /usr/local/sbin is not in your PATH  
  55. You can amend this by altering your ~/.bashrc file  
记下这些路径和使用方法,以后会用得到

Tags: mac, php