MAC用brew安装php5.6发生的问题

我按照网上一片文档来安装php5.6

文档这么写的
brew install php56 \
--without-snmp \
--without-apache \
--with-debug \
--with-fpm \
--with-intl \
--with-homebrew-curl \
--with-homebrew-libxslt \
--with-homebrew-openssl \
--with-imap \
--with-mysql \
--with-tidy
由于OSX已经自带了PHP环境,因此需要修改系统路径,优先运行brew安装的版本,在~/.bashrc里加入:

export PATH="/usr/local/bin:/usr/local/sbin:$PATH"
如果要安装新的php扩展,可以直接安装而不用每次重新编译php,所有的扩展可以通过

brew install php56-gearman php56-msgpack php56-memcache php56-memcached php56-mongo php56-phalcon php56-redis php56-xdebug

最后我安装完成后遇到了个问题 php -v

Module compiled with build ID=API20131226,NTS
PHP compiled with build ID=API20131226,NTS,debug
These options need to match
in Unknown on line 0
PHP Warning: PHP Startup: phalcon: Unable to initialize module
Module compiled with build ID=API20131226,NTS
PHP compiled with build ID=API20131226,NTS,debug
These options need to match
in Unknown on line 0

Warning: PHP Startup: phalcon: Unable to initialize module
Module compiled with build ID=API20131226,NTS
PHP compiled with build ID=API20131226,NTS,debug
These options need to match
in Unknown on line 0
PHP Warning: PHP Startup: redis: Unable to initialize module
Module compiled with build ID=API20131226,NTS
PHP compiled with build ID=API20131226,NTS,debug
These options need to match
in Unknown on line 0

Warning: PHP Startup: redis: Unable to initialize module
Module compiled with build ID=API20131226,NTS
PHP compiled with build ID=API20131226,NTS,debug
These options need to match
in Unknown on line 0
PHP Warning: PHP Startup: swoole: Unable to initialize module
Module compiled with build ID=API20131226,NTS
PHP compiled with build ID=API20131226,NTS,debug
These options need to match
in Unknown on line 0

Warning: PHP Startup: swoole: Unable to initialize module
Module compiled with build ID=API20131226,NTS
PHP compiled with build ID=API20131226,NTS,debug
These options need to match
in Unknown on line 0
PHP 5.6.29 (cli) (built: Mar 10 2017 01:58:37) (DEBUG)
Copyright (c) 1997-2016 The PHP Group
Zend Engine v2.6.0, Copyright (c) 1998-2016 Zend Technologies
➜ ~

Session Restored

求教大神给解决一下。 头痛啊

阅读 6.9k
5 个回答

这个提示是警告,应该不会影响php本身
可以使用 $ php -m 查看已安装的扩展
如果没有请一个一个安装

phalcon ,redis,swoole这几个扩展没有安装吧?php -m看一下。

命令php -i | grep php.ini看一下你的php.ini文件里面是不是开启了这几个扩展.如果有先注释掉,然后php -v再看下。

Unknown(0) : Warning – PHP Startup: mongo: Unable to initialize module
Module compiled with build ID=API20131226,NTS
PHP compiled with build ID=API20131226,NTS,debug
These options need to match
brew reinstall XXXX –build-from-source
brew reinstall XXXX(php56-mcrypt) –build-from-source

example for swoole :

brew reinstall -v homebrew/php/php56-swoole --build-from-source

这个只是一个警告,警告这个module与当前php版本不匹配。
但是你会发现build ID其实一致的。
这时你需要将这些module先remove掉。(如:brew remove php56-xhprof)
再进行install的时候增加参数--build-from-source (如:brew install php56-xhprof --build-from-source)

If --build-from-source or -s is passed, compile the specified formula from source even if a bottle is provided. Dependencies will still be installed from bottles if they are available.

撰写回答
你尚未登录,登录后可以
  • 和开发者交流问题的细节
  • 关注并接收问题和回答的更新提醒
  • 参与内容的编辑和改进,让解决方法与时俱进
推荐问题