mac安装lnmp环境中php扩展遇到的问题

在装好lnmp环境之后,执行php -m命令查看php扩展时,碰到如下警告:

1.

Cannot load Xdebug - it was built with configuration API220131226,NTS, whereas running engine is API220131226,NTS,debug

2.

PHP Warning:  PHP Startup: xhprof: 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


3.

PHP Warning:  PHP Startup: Unable to load dynamic library '/usr/local/opt/php56-gearman/gearman.so' - dlopen(/usr/local/opt/php56-gearman/gearman.so, 9): image not found in Unknown on line 0


在参考了链接 http://youlanglang.com/macxia-nmphuan-jing-de-da-jian-mnmp-2/ 之后,发现如下解决办法:

  • 问题1:如果 php -v 后,mcrypt会有这样的问题
1
2
3
4
5
PHP Warning:  PHP Startup: mcrypt: Unable to initialize module
Module compiled with build ID=API20151012,NTS
PHP compiled with build ID=API20151012,NTS,debug
These options need to match
in Unknown on line 0

则用此命令重装一下

1
brew reinstall mcrypt --build-from-source php70-mcrypt --build-from-source
  • 问题2:如果 php -v 后,memcached 有这样的问题:
1
PHP Deprecated: PHP Startup: memcached.sess_lock_wait and memcached.sess_lock_max_wait are deprecated. Please update your configuration to use memcached.sess_lock_wait_min, memcached.sess_lock_wait_max and memcached.sess_lock_retries in Unknown on line 0Deprecated: PHP Startup: memcached.sess_lock_wait and memcached.sess_lock_max_wait are deprecated. Please update your configuration to use memcached.sess_lock_wait_min, memcached.sess_lock_wait_max and memcached.sess_lock_retries in Unknown on line 0PHP Deprecated: PHP Startup: memcached.sess_lock_wait and memcached.sess_lock_max_wait are deprecated. Please update your configuration to use memcached.sess_lock_wait_min, memcached.sess_lock_wait_max and memcached.sess_lock_retries in Unknown on line 0Deprecated: PHP Startup: memcached.sess_lock_wait and memcached.sess_lock_max_wait are deprecated. Please update your configuration to use memcached.sess_lock_wait_min, memcached.sess_lock_wait_max and memcached.sess_lock_retries in Unknown on line 0PHP 7.0.2 (cli) (built: Jan 7 2016 10:40:26) ( NTS )Copyright (c) 1997-2015 The PHP GroupZend Engine v3.0.0, Copyright (c) 1998-2015 Zend Technologies with Xdebug v2.4.0RC3, Copyright (c) 2002-2015, by Derick Rethans

则需要修改一下配置文件/usr/local/etc/php/7.0/conf.d/ext-memcached.ini,将以下两句注释:

1
2
;memcached.sess_lock_wait = 150000
;memcached.sess_lock_max_wait = 0
  • 问题3:如果 php -v 有以下问题:
1
Cannot load Xdebug - it was built with configuration API320151012,NTS, whereas running engine is API320151012,NTS,debug

则用此命令重装一下:

1
brew install php70-xdebug --build-from-source

我直接使用了一条命令,解决了其中遇到的大部分警告:

brew reinstall php56-pdo-dblib --build-from-source php56-pdo-dblib

--build-from-source


只要将 php56-pdo-dblib替换成你要安装的扩展,即可解决问题。特此记录。其中深层次原因还有待解决,也请看到的朋友可以指点迷津。

你可能感兴趣的:(mac,php)