苹果下面安装php5.4还算是比较方便的,主要是默认为php5.3,想用trait的时候,没5.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 会告诉你:
the php.ini file can be found in: /usr/local/etc/php/5.4/php.ini pear if pear complains about permissions, 'fix' the default pear permissions and config: chmod -r ug+w /usr/local/cellar/php54/5.4.13/lib/php pear config-set php_ini /usr/local/etc/php/5.4/php.ini extensions if you are having issues with custom extension compiling, ensure that this php is in your path: path=$(brew --prefix josegonzalez/php/php54)/bin:$path php54 extensions will always be compiled against this php. please install them using --without-homebrew-php to enable compiling against system php. ? intl support ? icu4c is broken as of mxcl/homebrew#03ed757c, so you will need to install intl as a separate extension: brew install php54-intl fpm to launch php-fpm on startup: * if this is your first install: mkdir -p ~/library/launchagents cp /usr/local/cellar/php54/5.4.13/homebrew-php.josegonzalez.php54.plist ~/library/launchagents/ launchctl load -w ~/library/launchagents/homebrew-php.josegonzalez.php54.plist * if this is an upgrade and you already have the homebrew-php.josegonzalez.php54.plist loaded: launchctl unload -w ~/library/launchagents/homebrew-php.josegonzalez.php54.plist cp /usr/local/cellar/php54/5.4.13/homebrew-php.josegonzalez.php54.plist ~/library/launchagents/ launchctl load -w ~/library/launchagents/homebrew-php.josegonzalez.php54.plist the control script is located at /usr/local/cellar/php54/5.4.13/sbin/php54-fpm 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: path=/sbin:$path you may also need to edit the plist to use the correct username. please note that the plist was called 'org.php-fpm.plist' in old versions of this formula. to have launchd start php54 at login: ln -sfv /usr/local/opt/php54/*.plist ~/library/launchagents then to load php54 now: launchctl load ~/library/launchagents/homebrew.mxcl.php54.plist warning: /usr/local/sbin is not in your path you can amend this by altering your ~/.bashrc file
记下这些路径和使用方法,以后会用得到 原文地址:mac下面安装php5.4, 感谢原作者分享。