关于MAC扩展问题的PHP 7

时间:2016-07-13 15:47:01

标签: php macos php-7 ampps

我在Mac上使用Softaculous AMPPS并尝试使用PHP 7,但我遇到了一些问题。

首先,当我将php版本从5.6更改为7时,我必须在httpd.conf进行这些更改以使Apache服务器启动:

  • 评论此行:
  

LoadModule php5_module {$ path} /php/libphp5.so

  • 添加此行
  

LoadModule php7_module {$ path} /php/libphp7.so

它开始了,但是当我在终端输入php -v时,我得到了错误的版本(5.4.45,我的机器本机php),所以我不得不将路径env更改为PHP AMPPS路径。现在当我输入php -v时,我得到了正确的版本,但现在我收到了这些警告:

PHP Warning:  PHP Startup: bz2: Unable to initialize module
Module compiled with module API=20131226
PHP    compiled with module API=20151012
These options need to match
 in Unknown on line 0

Warning: PHP Startup: bz2: Unable to initialize module
Module compiled with module API=20131226
PHP    compiled with module API=20151012
These options need to match
 in Unknown on line 0
PHP Warning:  PHP Startup: curl: Unable to initialize module
Module compiled with module API=20131226
PHP    compiled with module API=20151012
These options need to match
 in Unknown on line 0

Warning: PHP Startup: curl: Unable to initialize module
Module compiled with module API=20131226
PHP    compiled with module API=20151012
These options need to match
 in Unknown on line 0
PHP Warning:  PHP Startup: Unable to load dynamic library '/Applications/AMPPS/php-5.6/lib/extensions/ext/intl.so' - dlopen(/Applications/AMPPS/php-5.6/lib/extensions/ext/intl.so, 9): Symbol not found: _zval_used_for_init
  Referenced from: /Applications/AMPPS/php-5.6/lib/extensions/ext/intl.so
  Expected in: flat namespace
 in /Applications/AMPPS/php-5.6/lib/extensions/ext/intl.so in Unknown on line 0

Warning: PHP Startup: Unable to load dynamic library '/Applications/AMPPS/php-5.6/lib/extensions/ext/intl.so' - dlopen(/Applications/AMPPS/php-5.6/lib/extensions/ext/intl.so, 9): Symbol not found: _zval_used_for_init
  Referenced from: /Applications/AMPPS/php-5.6/lib/extensions/ext/intl.so
  Expected in: flat namespace
 in /Applications/AMPPS/php-5.6/lib/extensions/ext/intl.so in Unknown on line 0
PHP Warning:  PHP Startup: mbstring: Unable to initialize module
Module compiled with module API=20131226
PHP    compiled with module API=20151012
These options need to match
 in Unknown on line 0

Warning: PHP Startup: mbstring: Unable to initialize module
Module compiled with module API=20131226
PHP    compiled with module API=20151012
These options need to match
 in Unknown on line 0
PHP Warning:  PHP Startup: Unable to load dynamic library '/Applications/AMPPS/php-5.6/lib/extensions/ext/mysqli.so' - dlopen(/Applications/AMPPS/php-5.6/lib/extensions/ext/mysqli.so, 9): Symbol not found: _zval_used_for_init
  Referenced from: /Applications/AMPPS/php-5.6/lib/extensions/ext/mysqli.so
  Expected in: flat namespace
 in /Applications/AMPPS/php-5.6/lib/extensions/ext/mysqli.so in Unknown on line 0

Warning: PHP Startup: Unable to load dynamic library '/Applications/AMPPS/php-5.6/lib/extensions/ext/mysqli.so' - dlopen(/Applications/AMPPS/php-5.6/lib/extensions/ext/mysqli.so, 9): Symbol not found: _zval_used_for_init
  Referenced from: /Applications/AMPPS/php-5.6/lib/extensions/ext/mysqli.so
  Expected in: flat namespace
 in /Applications/AMPPS/php-5.6/lib/extensions/ext/mysqli.so in Unknown on line 0
PHP Warning:  PHP Startup: pdo_mysql: Unable to initialize module
Module compiled with module API=20131226
PHP    compiled with module API=20151012
These options need to match
 in Unknown on line 0

Warning: PHP Startup: pdo_mysql: Unable to initialize module
Module compiled with module API=20131226
PHP    compiled with module API=20151012
These options need to match
 in Unknown on line 0
PHP Warning:  PHP Startup: pdo_sqlite: Unable to initialize module
Module compiled with module API=20131226
PHP    compiled with module API=20151012
These options need to match
 in Unknown on line 0

Warning: PHP Startup: pdo_sqlite: Unable to initialize module
Module compiled with module API=20131226
PHP    compiled with module API=20151012
These options need to match
 in Unknown on line 0
PHP Warning:  PHP Startup: Unable to load dynamic library '/Applications/AMPPS/php-5.6/lib/extensions/ext/soap.so' - dlopen(/Applications/AMPPS/php-5.6/lib/extensions/ext/soap.so, 9): Symbol not found: _zval_used_for_init
  Referenced from: /Applications/AMPPS/php-5.6/lib/extensions/ext/soap.so
  Expected in: flat namespace
 in /Applications/AMPPS/php-5.6/lib/extensions/ext/soap.so in Unknown on line 0

Warning: PHP Startup: Unable to load dynamic library '/Applications/AMPPS/php-5.6/lib/extensions/ext/soap.so' - dlopen(/Applications/AMPPS/php-5.6/lib/extensions/ext/soap.so, 9): Symbol not found: _zval_used_for_init
  Referenced from: /Applications/AMPPS/php-5.6/lib/extensions/ext/soap.so
  Expected in: flat namespace
 in /Applications/AMPPS/php-5.6/lib/extensions/ext/soap.so in Unknown on line 0
PHP Warning:  PHP Startup: Unable to load dynamic library '/Applications/AMPPS/php-5.6/lib/extensions/ext/sockets.so' - dlopen(/Applications/AMPPS/php-5.6/lib/extensions/ext/sockets.so, 9): Symbol not found: _zval_used_for_init
  Referenced from: /Applications/AMPPS/php-5.6/lib/extensions/ext/sockets.so
  Expected in: flat namespace
 in /Applications/AMPPS/php-5.6/lib/extensions/ext/sockets.so in Unknown on line 0

Warning: PHP Startup: Unable to load dynamic library '/Applications/AMPPS/php-5.6/lib/extensions/ext/sockets.so' - dlopen(/Applications/AMPPS/php-5.6/lib/extensions/ext/sockets.so, 9): Symbol not found: _zval_used_for_init
  Referenced from: /Applications/AMPPS/php-5.6/lib/extensions/ext/sockets.so
  Expected in: flat namespace
 in /Applications/AMPPS/php-5.6/lib/extensions/ext/sockets.so in Unknown on line 0
PHP Warning:  PHP Startup: sqlite3: Unable to initialize module
Module compiled with module API=20131226
PHP    compiled with module API=20151012
These options need to match
 in Unknown on line 0

Warning: PHP Startup: sqlite3: Unable to initialize module
Module compiled with module API=20131226
PHP    compiled with module API=20151012
These options need to match
 in Unknown on line 0
PHP Warning:  PHP Startup: zlib: Unable to initialize module
Module compiled with module API=20131226
PHP    compiled with module API=20151012
These options need to match
 in Unknown on line 0

Warning: PHP Startup: zlib: Unable to initialize module
Module compiled with module API=20131226
PHP    compiled with module API=20151012
These options need to match
 in Unknown on line 0
PHP 7.0.2 (cli) (built: Jan 10 2016 03:00:54) ( NTS )
Copyright (c) 1997-2015 The PHP Group
Zend Engine v3.0.0, Copyright (c) 1998-2015 Zend Technologies
iMac-de-MundusCarbo:~ admin$ php -v
PHP Warning:  PHP Startup: bz2: Unable to initialize module
Module compiled with module API=20131226
PHP    compiled with module API=20151012
These options need to match
 in Unknown on line 0

Warning: PHP Startup: bz2: Unable to initialize module
Module compiled with module API=20131226
PHP    compiled with module API=20151012
These options need to match
 in Unknown on line 0
PHP Warning:  PHP Startup: curl: Unable to initialize module
Module compiled with module API=20131226
PHP    compiled with module API=20151012
These options need to match
 in Unknown on line 0

Warning: PHP Startup: curl: Unable to initialize module
Module compiled with module API=20131226
PHP    compiled with module API=20151012
These options need to match
 in Unknown on line 0
PHP Warning:  PHP Startup: Unable to load dynamic library '/Applications/AMPPS/php-5.6/lib/extensions/ext/intl.so' - dlopen(/Applications/AMPPS/php-5.6/lib/extensions/ext/intl.so, 9): Symbol not found: _zval_used_for_init
  Referenced from: /Applications/AMPPS/php-5.6/lib/extensions/ext/intl.so
  Expected in: flat namespace
 in /Applications/AMPPS/php-5.6/lib/extensions/ext/intl.so in Unknown on line 0

Warning: PHP Startup: Unable to load dynamic library '/Applications/AMPPS/php-5.6/lib/extensions/ext/intl.so' - dlopen(/Applications/AMPPS/php-5.6/lib/extensions/ext/intl.so, 9): Symbol not found: _zval_used_for_init
  Referenced from: /Applications/AMPPS/php-5.6/lib/extensions/ext/intl.so
  Expected in: flat namespace
 in /Applications/AMPPS/php-5.6/lib/extensions/ext/intl.so in Unknown on line 0
PHP Warning:  PHP Startup: mbstring: Unable to initialize module
Module compiled with module API=20131226
PHP    compiled with module API=20151012
These options need to match
 in Unknown on line 0

Warning: PHP Startup: mbstring: Unable to initialize module
Module compiled with module API=20131226
PHP    compiled with module API=20151012
These options need to match
 in Unknown on line 0
PHP Warning:  PHP Startup: Unable to load dynamic library '/Applications/AMPPS/php-5.6/lib/extensions/ext/mysqli.so' - dlopen(/Applications/AMPPS/php-5.6/lib/extensions/ext/mysqli.so, 9): Symbol not found: _zval_used_for_init
  Referenced from: /Applications/AMPPS/php-5.6/lib/extensions/ext/mysqli.so
  Expected in: flat namespace
 in /Applications/AMPPS/php-5.6/lib/extensions/ext/mysqli.so in Unknown on line 0

Warning: PHP Startup: Unable to load dynamic library '/Applications/AMPPS/php-5.6/lib/extensions/ext/mysqli.so' - dlopen(/Applications/AMPPS/php-5.6/lib/extensions/ext/mysqli.so, 9): Symbol not found: _zval_used_for_init
  Referenced from: /Applications/AMPPS/php-5.6/lib/extensions/ext/mysqli.so
  Expected in: flat namespace
 in /Applications/AMPPS/php-5.6/lib/extensions/ext/mysqli.so in Unknown on line 0
PHP Warning:  PHP Startup: pdo_mysql: Unable to initialize module
Module compiled with module API=20131226
PHP    compiled with module API=20151012
These options need to match
 in Unknown on line 0

Warning: PHP Startup: pdo_mysql: Unable to initialize module
Module compiled with module API=20131226
PHP    compiled with module API=20151012
These options need to match
 in Unknown on line 0
PHP Warning:  PHP Startup: pdo_sqlite: Unable to initialize module
Module compiled with module API=20131226
PHP    compiled with module API=20151012
These options need to match
 in Unknown on line 0

Warning: PHP Startup: pdo_sqlite: Unable to initialize module
Module compiled with module API=20131226
PHP    compiled with module API=20151012
These options need to match
 in Unknown on line 0
PHP Warning:  PHP Startup: Unable to load dynamic library '/Applications/AMPPS/php-5.6/lib/extensions/ext/soap.so' - dlopen(/Applications/AMPPS/php-5.6/lib/extensions/ext/soap.so, 9): Symbol not found: _zval_used_for_init
  Referenced from: /Applications/AMPPS/php-5.6/lib/extensions/ext/soap.so
  Expected in: flat namespace
 in /Applications/AMPPS/php-5.6/lib/extensions/ext/soap.so in Unknown on line 0

Warning: PHP Startup: Unable to load dynamic library '/Applications/AMPPS/php-5.6/lib/extensions/ext/soap.so' - dlopen(/Applications/AMPPS/php-5.6/lib/extensions/ext/soap.so, 9): Symbol not found: _zval_used_for_init
  Referenced from: /Applications/AMPPS/php-5.6/lib/extensions/ext/soap.so
  Expected in: flat namespace
 in /Applications/AMPPS/php-5.6/lib/extensions/ext/soap.so in Unknown on line 0
PHP Warning:  PHP Startup: Unable to load dynamic library '/Applications/AMPPS/php-5.6/lib/extensions/ext/sockets.so' - dlopen(/Applications/AMPPS/php-5.6/lib/extensions/ext/sockets.so, 9): Symbol not found: _zval_used_for_init
  Referenced from: /Applications/AMPPS/php-5.6/lib/extensions/ext/sockets.so
  Expected in: flat namespace
 in /Applications/AMPPS/php-5.6/lib/extensions/ext/sockets.so in Unknown on line 0

Warning: PHP Startup: Unable to load dynamic library '/Applications/AMPPS/php-5.6/lib/extensions/ext/sockets.so' - dlopen(/Applications/AMPPS/php-5.6/lib/extensions/ext/sockets.so, 9): Symbol not found: _zval_used_for_init
  Referenced from: /Applications/AMPPS/php-5.6/lib/extensions/ext/sockets.so
  Expected in: flat namespace
 in /Applications/AMPPS/php-5.6/lib/extensions/ext/sockets.so in Unknown on line 0
PHP Warning:  PHP Startup: sqlite3: Unable to initialize module
Module compiled with module API=20131226
PHP    compiled with module API=20151012
These options need to match
 in Unknown on line 0

Warning: PHP Startup: sqlite3: Unable to initialize module
Module compiled with module API=20131226
PHP    compiled with module API=20151012
These options need to match
 in Unknown on line 0
PHP Warning:  PHP Startup: zlib: Unable to initialize module
Module compiled with module API=20131226
PHP    compiled with module API=20151012
These options need to match
 in Unknown on line 0

Warning: PHP Startup: zlib: Unable to initialize module
Module compiled with module API=20131226
PHP    compiled with module API=20151012
These options need to match
 in Unknown on line 0
PHP 7.0.2 (cli) (built: Jan 10 2016 03:00:54) ( NTS )
Copyright (c) 1997-2015 The PHP Group
Zend Engine v3.0.0, Copyright (c) 1998-2015 Zend Technologies

我在Php Extensions窗口中选择的扩展无法初始化。

可能会发生什么?

我还尝试安装pear / pecl来手动安装/更新这些软件包。但是当我输入pear version时,我得到了5.4.45的PHP版本,然后我遇到了使用pecl的问题,我无法设置梨使用AMPPS php(版本7)。

任何提示都会很好,我迷失了。我也是新手:)

1 个答案:

答案 0 :(得分:0)

在我的情况下,它发生的原因只是因为我在从PHP-7.0.15切换到PHP-5.6.30之后没有重新启动我的终端会话。

php -v

中将php可执行文件更新为php-5.6后,我正在尝试加载php7模块~/.bash_profile