2

我在 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 version5.4.45 PHP 版本时,我在使用 pecl 时遇到了问题,我无法将 pear 设置为使用 AMPPS php(版本 7)。

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

4

1 回答 1

0

就我而言,这只是因为我在从 PHP-7.0.15 切换到 PHP-5.6.30 后没有重新启动终端会话。

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

于 2017-05-16T12:36:14.177 回答