【发布时间】:2013-03-30 16:58:26
【问题描述】:
当我在 php laravel 3.2 项目文件夹中运行以下命令时
php artisan key:generate
然后我收到此警告
警告:ob_start(): function 'mb_output_handler' not found or invalid function name in /Users/zafar/Sites/laravel-todo/laravel/core.php on line 32
在我的 phpinfo.php 中,我已经启用了 mbstring。但是,当我执行php --ri mbstring 时,它会显示Extension 'mbstring' not present.。我怎么解决这个问题?我使用 Mac OS X Lion 10.7.5。我最近使用http://php-osx.liip.ch/ 将我的 php 升级到 php 5.4.13。
更新
在我的 phpinfo 文件中,php 版本是 PHP Version 5.4.13,但是当我执行 php -v 时,它会显示以下输出
PHP 5.4.11 (cli) (built: Jan 26 2013 20:10:19)
Copyright (c) 1997-2013 The PHP Group
Zend Engine v2.4.0, Copyright (c) 1998-2013 Zend Technologies
更新 2
当我运行php -i 时,它会显示以下输出
phpinfo()
PHP Version => 5.4.11
System => Darwin Zafars-MacBook-Pro.local 11.4.2 Darwin Kernel Version 11.4.2: Thu Aug 23 16:25:48 PDT 2012; root:xnu-1699.32.7~1/RELEASE_X86_64 x86_64
Build Date => Jan 26 2013 20:09:37
Configure Command => './configure'
Server API => Command Line Interface
Virtual Directory Support => disabled
Configuration File (php.ini) Path => /usr/local/lib
Loaded Configuration File => /usr/local/lib/php.ini
Scan this dir for additional .ini files => (none)
Additional .ini files parsed => (none)
PHP API => 20100412
PHP Extension => 20100525
Zend Extension => 220100525
Zend Extension Build => API220100525,NTS
PHP Extension Build => API20100525,NTS
Debug Build => no
Thread Safety => disabled
Zend Signal Handling => disabled
Zend Memory Manager => enabled
Zend Multibyte Support => disabled
IPv6 Support => enabled
DTrace Support => disabled
Registered PHP Streams => php, file, glob, data, http, ftp, phar
Registered Stream Socket Transports => tcp, udp, unix, udg
Registered Stream Filters => convert.iconv.*, string.rot13, string.toupper, string.tolower, string.strip_tags, convert.*, consumed, dechunk
This program makes use of the Zend Scripting Language Engine:
Zend Engine v2.4.0, Copyright (c) 1998-2013 Zend Technologies
_______________________________________________________________________
Configuration
Core
PHP Version => 5.4.11
Directive => Local Value => Master Value
allow_url_fopen => On => On
allow_url_include => Off => Off
always_populate_raw_post_data => Off => Off
arg_separator.input => & => &
arg_separator.output => & => &
当我执行which php 时,它给了我这条路径/usr/local/bin/php,然后我执行了/usr/local/bin/php -i,它给了我以下输出
phpinfo()
PHP Version => 5.4.11
System => Darwin Zafars-MacBook-Pro.local 11.4.2 Darwin Kernel Version 11.4.2: Thu Aug 23 16:25:48 PDT 2012; root:xnu-1699.32.7~1/RELEASE_X86_64 x86_64
Build Date => Jan 26 2013 20:09:37
Configure Command => './configure'
Server API => Command Line Interface
Virtual Directory Support => disabled
Configuration File (php.ini) Path => /usr/local/lib
Loaded Configuration File => /usr/local/lib/php.ini
Scan this dir for additional .ini files => (none)
Additional .ini files parsed => (none)
PHP API => 20100412
PHP Extension => 20100525
Zend Extension => 220100525
Zend Extension Build => API220100525,NTS
PHP Extension Build => API20100525,NTS
Debug Build => no
Thread Safety => disabled
Zend Signal Handling => disabled
Zend Memory Manager => enabled
Zend Multibyte Support => disabled
IPv6 Support => enabled
DTrace Support => disabled
Registered PHP Streams => php, file, glob, data, http, ftp, phar
Registered Stream Socket Transports => tcp, udp, unix, udg
Registered Stream Filters => convert.iconv.*, string.rot13, string.toupper, string.tolower, string.strip_tags, convert.*, consumed, dechunk
This program makes use of the Zend Scripting Language Engine:
Zend Engine v2.4.0, Copyright (c) 1998-2013 Zend Technologies
_______________________________________________________________________
Configuration
Core
PHP Version => 5.4.11
Directive => Local Value => Master Value
allow_url_fopen => On => On
allow_url_include => Off => Off
always_populate_raw_post_data => Off => Off
arg_separator.input => & => &
更新 3
当我运行 /usr/local/php5/bin/php -i 时,我得到以下输出
PHP 警告:PHP 启动:无法加载动态库 '/usr/local/php5/lib/php/extensions/no-debug-non-zts-20100525/php-mbstring.dll' - dlopen(/usr/ local/php5/lib/php/extensions/no-debug-non-zts-20100525/php-mbstring.dll, 9): 在第 0 行的未知中找不到图像
Warning: PHP Startup: Unable to load dynamic library '/usr/local/php5/lib/php/extensions/no-debug-non-zts-20100525/php-mbstring.dll' - dlopen(/usr/local/php5/lib/php/extensions/no-debug-non-zts-20100525/php-mbstring.dll, 9): image not found in Unknown on line 0
phpinfo()
PHP Version => 5.4.13
System => Darwin Zafars-MacBook-Pro.local 11.4.2 Darwin Kernel Version 11.4.2: Thu Aug 23 16:25:48 PDT 2012; root:xnu-1699.32.7~1/RELEASE_X86_64 x86_64
Build Date => Mar 19 2013 17:10:14
Configure Command => './configure' '--prefix=/usr/local/php5' '--with-apxs2=/usr/sbin/apxs' '--with-config-file-scan-dir=/usr/local/php5/php.d' '--with-openssl=/usr' '--with-zlib=/usr' '--with-zlib-dir=/usr' '--with-gd' '--with-ldap' '--with-xmlrpc' '--enable-exif' '--enable-soap' '--enable-sqlite-utf8' '--enable-wddx' '--enable-ftp' '--enable-sockets' '--with-bz2=/usr' '--enable-zip' '--enable-shmop' '--enable-sysvsem' '--enable-sysvshm' '--enable-sysvmsg' '--enable-mbstring' '--enable-bcmath' '--enable-calendar' '--with-iodbc' '--with-mhash' '--enable-fpm' '--with-mysql=mysqlnd' '--with-mysqli=mysqlnd' '--with-pdo-mysql=mysqlnd' '--enable-pcntl' '--enable-dtrace' '--with-iconv=/usr/local/php5' '--with-icu-dir=/usr/local/php5' '--with-mssql=shared,/usr/local/php5' '--with-pdo-dblib=shared,/usr/local/php5' '--with-libxml-dir=shared,/usr/local/php5' '--with-xsl=shared,/usr/local/php5' '--with-imap=../imap-2007f' '--with-kerberos=/usr' '--with-imap-ssl=/usr' '--with-gettext=/usr/local/php5' '--with-curl=shared,/usr/local/php5' '--with-png-dir=/usr/local/php5' '--with-jpeg-dir=/usr/local/php5' '--enable-gd-native-ttf' '--with-freetype-dir=/usr/local/php5' '--with-pgsql=shared,/usr/local/php5' '--with-pdo-pgsql=shared,/usr/local/php5' '--with-mcrypt=shared,/usr/local/php5' '--with-tidy=/usr/local/php5' '--with-gmp=shared,/usr/local/php5' '--with-readline=shared,/usr/local/php5'
Server API => Command Line Interface
Virtual Directory Support => disabled
Configuration File (php.ini) Path => /usr/local/php5/lib
Loaded Configuration File => /usr/local/php5/lib/php.ini
Scan this dir for additional .ini files => /usr/local/php5/php.d
Additional .ini files parsed => /usr/local/php5/php.d/10-extension_dir.ini,
/usr/local/php5/php.d/50-extension-apc.ini,
/usr/local/php5/php.d/50-extension-curl.ini,
/usr/local/php5/php.d/50-extension-gmp.ini,
/usr/local/php5/php.d/50-extension-igbinary.ini,
/usr/local/php5/php.d/50-extension-intl.ini,
/usr/local/php5/php.d/50-extension-mcrypt.ini,
/usr/local/php5/php.d/50-extension-memcache.ini,
/usr/local/php5/php.d/50-extension-memcached.ini,
/usr/local/php5/php.d/50-extension-mongo.ini,
/usr/local/php5/php.d/50-extension-mssql.ini,
/usr/local/php5/php.d/50-extension-oauth.ini,
/usr/local/php5/php.d/50-extension-pdo_dblib.ini,
/usr/local/php5/php.d/50-extension-pdo_pgsql.ini,
/usr/local/php5/php.d/50-extension-pgsql.ini,
/usr/local/php5/php.d/50-extension-readline.ini,
/usr/local/php5/php.d/50-extension-solr.ini,
/usr/local/php5/php.d/50-extension-twig.ini,
/usr/local/php5/php.d/50-extension-uploadprogress.ini,
/usr/local/php5/php.d/50-extension-xdebug.ini,
/usr/local/php5/php.d/50-extension-xhprof.ini,
/usr/local/php5/php.d/50-extension-xsl.ini,
/usr/local/php5/php.d/99-liip-developer.ini
PHP API => 20100412
PHP Extension => 20100525
【问题讨论】:
-
我在某处(不记得在哪里)读到您还必须启用 php_mysql.dll 和 php_mysqli.dll。你有吗?
-
在 phpinfo.php 文件中启用。但是
php --ri mysql和php --ri mysqli表示Extension 'mysql' not present和Extension 'mysql' not present -
也许这与 mbstring 无关。错误提示“或无效的函数名称”。看看core.php...?
-
请注意,控制台上的 PHP 可能使用与 Web 服务器中不同的“php.ini”。检查
php -i的前 20 行,看看它在哪里。 -
另外,执行
which php以查看正在运行的内容 - 您似乎安装了两个版本。我希望一个是库存的 OS X 副本,另一个是您自己安装的。试试/path/to/your/php -i看看是否会给你带来不同的结果。