目录
回复讨论(解决方案)
首页 后端开发 php教程 【LAMP】Fatal error: Call to undefined function mb_detect_encoding()

【LAMP】Fatal error: Call to undefined function mb_detect_encoding()

Jun 23, 2016 pm 01:55 PM
error fatal undefined

我安装LAMP环境,php-xxx-.tar.gz解压缩后的目录 /home/default7/LAMP/php-5.5.13
PHP安装到的目录 /usr/local/php5
然后我安装之后,打开phpmyadmin,报错提示:

Fatal error: Call to undefined function mb_detect_encoding() in /usr/local/apache2/htdocs/phpmyadmin/libraries/php-gettext/gettext.inc on line 177
登录后复制


命令提示行查看php已经安装的模块: mbstring是存在的

[root@localhost php-5.5.13]# php -m
[PHP Modules]
bz2
calendar
Core
ctype
curl
date
ereg
exif
fileinfo
filter
ftp
gettext
gmp
hash
iconv
json
libxml
mbstring
openssl
pcntl
pcre
Phar
readline
Reflection
session
shmop
SimpleXML
sockets
SPL
standard
tokenizer
xml
zip
zlib

[Zend Modules]



查看phpinfo,相关几个:
PHP Version 5.5.13Configure Command 	'./configure' '--with-apxs2=/usr/local/apache2/bin/apxs' '--with-mysql' '--prefix=/usr/local/php5' Server API 	Apache 2.0 HandlerVirtual Directory Support 	enabledConfiguration File (php.ini) Path 	/usr/local/php5/libLoaded Configuration File 	/usr/local/php5/lib/php.iniScan this dir for additional .ini files 	(none)Additional .ini files parsed 	(none) extension_dir	/usr/local/php5/lib/php/extensions/no-debug-zts-20121212	/usr/local/php5/lib/php/extensions/no-debug-zts-20121212
登录后复制


查看php5安装后的extension目录(是空的):
[root@localhost ext]# ll /usr/local/php5/lib/php/extensions/no-debug-zts-20121212total 488-rwxr-xr-x. 1 root root 495775 Jun 15 01:01 opcache.so[root@localhost ext]# ll /usr/local/php5/lib/php/extensionstotal 4drwxr-xr-x. 2 root root 4096 Jun 15 01:01 no-debug-zts-20121212
登录后复制


但是在安装后的目录里面另外一个目录却有(目录 /usr/local/php5/include/php/ext):
[root@localhost ext]# pwd/usr/local/php5/include/php/ext[root@localhost ext]# lltotal 68drwxr-xr-x. 3 root root 4096 Jun 15 01:01 datedrwxr-xr-x. 2 root root 4096 Jun 15 01:01 domdrwxr-xr-x. 3 root root 4096 Jun 15 01:01 eregdrwxr-xr-x. 2 root root 4096 Jun 15 01:01 filterdrwxr-xr-x. 2 root root 4096 Jun 15 01:01 hashdrwxr-xr-x. 2 root root 4096 Jun 15 01:01 iconvdrwxr-xr-x. 2 root root 4096 Jun 15 01:01 jsondrwxr-xr-x. 2 root root 4096 Jun 15 01:01 libxmldrwxr-xr-x. 2 root root 4096 Jun 15 01:02 mysqlnddrwxr-xr-x. 3 root root 4096 Jun 15 01:01 pcredrwxr-xr-x. 2 root root 4096 Jun 15 01:02 pdodrwxr-xr-x. 2 root root 4096 Jun 15 01:01 phardrwxr-xr-x. 2 root root 4096 Jun 15 01:01 sessiondrwxr-xr-x. 2 root root 4096 Jun 15 01:01 spldrwxr-xr-x. 3 root root 4096 Jun 15 01:01 sqlite3drwxr-xr-x. 2 root root 4096 Jun 15 01:02 standarddrwxr-xr-x. 2 root root 4096 Jun 15 01:02 xml[root@localhost ext]# 
登录后复制



在安装文件夹(/home/default7/LAMP/php-5.5.13/ext)中有mbstring:
[root@localhost ext]# lltotal 328drwxr-xr-x.  4 1001 1001  4096 May 28 17:06 bcmathdrwxr-xr-x.  3 1001 1001  4096 May 28 17:06 bz2drwxr-xr-x.  3 1001 1001  4096 May 28 17:06 calendardrwxr-xr-x.  3 1001 1001  4096 May 28 17:06 com_dotnetdrwxr-xr-x.  4 1001 1001  4096 Jun 15 00:27 ctypedrwxr-xr-x.  3 1001 1001  4096 May 28 17:06 curldrwxr-xr-x.  5 1001 1001  4096 Jun 15 00:25 datedrwxr-xr-x.  6 1001 1001  4096 May 28 17:06 dbadrwxr-xr-x.  5 1001 1001  4096 Jun 15 00:27 domdrwxr-xr-x.  4 1001 1001  4096 May 28 17:06 enchantdrwxr-xr-x.  5 1001 1001  4096 Jun 15 00:25 eregdrwxr-xr-x.  3 1001 1001  4096 May 28 17:06 exif-rwxr-xr-x.  1 1001 1001  8174 May 28 17:06 ext_skel-rw-r--r--.  1 1001 1001  1524 May 28 17:06 ext_skel_win32.phpdrwxr-xr-x.  5 1001 1001  4096 Jun 15 00:27 fileinfodrwxr-xr-x.  5 1001 1001  4096 Jun 15 00:28 filterdrwxr-xr-x.  3 1001 1001  4096 May 28 17:06 ftpdrwxr-xr-x.  4 1001 1001  4096 May 28 17:06 gddrwxr-xr-x.  3 1001 1001  4096 May 28 17:06 gettextdrwxr-xr-x.  3 1001 1001  4096 May 28 17:06 gmpdrwxr-xr-x.  4 1001 1001  4096 Jun 15 00:43 hashdrwxr-xr-x.  4 1001 1001  4096 Jun 15 00:28 iconvdrwxr-xr-x.  3 1001 1001  4096 May 28 17:06 imapdrwxr-xr-x.  3 1001 1001  4096 May 28 17:06 interbasedrwxr-xr-x. 20 1001 1001  4096 May 28 17:06 intldrwxr-xr-x.  4 1001 1001  4096 Jun 15 00:28 jsondrwxr-xr-x.  3 1001 1001  4096 May 28 17:06 ldapdrwxr-xr-x.  4 1001 1001  4096 Jun 15 00:26 libxmldrwxr-xr-x.  6 1001 1001  4096 May 28 17:06 mbstringdrwxr-xr-x.  3 1001 1001  4096 May 28 17:06 mcryptdrwxr-xr-x.  2 1001 1001  4096 May 28 17:06 mssqldrwxr-xr-x.  4 1001 1001  4096 Jun 15 00:28 mysqldrwxr-xr-x.  3 1001 1001  4096 May 28 17:06 mysqlidrwxr-xr-x.  3 1001 1001  4096 Jun 15 00:32 mysqlnddrwxr-xr-x.  3 1001 1001  4096 May 28 17:06 oci8drwxr-xr-x.  3 1001 1001  4096 May 28 17:06 odbcdrwxr-xr-x.  5 1001 1001  4096 Jun 15 00:35 opcachedrwxr-xr-x.  3 1001 1001  4096 May 28 17:06 openssldrwxr-xr-x.  3 1001 1001  4096 May 28 17:06 pcntldrwxr-xr-x.  5 1001 1001  4096 Jun 15 00:26 pcredrwxr-xr-x.  4 1001 1001  4096 Jun 15 00:28 pdodrwxr-xr-x.  3 1001 1001  4096 May 28 17:06 pdo_dblibdrwxr-xr-x.  3 1001 1001  4096 May 28 17:06 pdo_firebirddrwxr-xr-x.  3 1001 1001  4096 May 28 17:06 pdo_mysqldrwxr-xr-x.  3 1001 1001  4096 May 28 17:06 pdo_ocidrwxr-xr-x.  3 1001 1001  4096 May 28 17:06 pdo_odbcdrwxr-xr-x.  3 1001 1001  4096 May 28 17:06 pdo_pgsqldrwxr-xr-x.  4 1001 1001  4096 Jun 15 00:29 pdo_sqlitedrwxr-xr-x.  3 1001 1001  4096 May 28 17:06 pgsqldrwxr-xr-x.  5 1001 1001  4096 Jun 15 01:41 phardrwxr-xr-x.  4 1001 1001  4096 Jun 15 00:29 posixdrwxr-xr-x.  3 1001 1001  4096 May 28 17:06 pspelldrwxr-xr-x.  3 1001 1001  4096 May 28 17:06 readlinedrwxr-xr-x.  2 1001 1001  4096 May 28 17:06 recodedrwxr-xr-x.  4 1001 1001  4096 Jun 15 00:29 reflectiondrwxr-xr-x.  4 1001 1001  4096 Jun 15 00:29 sessiondrwxr-xr-x.  3 1001 1001  4096 May 28 17:06 shmopdrwxr-xr-x.  5 1001 1001  4096 Jun 15 00:29 simplexmldrwxr-xr-x.  3 1001 1001  4096 May 28 17:06 skeletondrwxr-xr-x.  3 1001 1001  4096 May 28 17:06 snmpdrwxr-xr-x.  4 1001 1001  4096 May 28 17:06 soapdrwxr-xr-x.  3 1001 1001  4096 May 28 17:06 socketsdrwxr-xr-x.  6 1001 1001  4096 Jun 15 00:29 spldrwxr-xr-x.  5 1001 1001  4096 Jun 15 00:26 sqlite3drwxr-xr-x.  5 1001 1001 12288 Jun 15 01:41 standarddrwxr-xr-x.  3 1001 1001  4096 May 28 17:06 sybase_ctdrwxr-xr-x.  3 1001 1001  4096 May 28 17:06 sysvmsgdrwxr-xr-x.  3 1001 1001  4096 May 28 17:06 sysvsemdrwxr-xr-x.  3 1001 1001  4096 May 28 17:06 sysvshmdrwxr-xr-x.  4 1001 1001  4096 May 28 17:06 tidydrwxr-xr-x.  4 1001 1001  4096 Jun 15 00:31 tokenizerdrwxr-xr-x.  3 1001 1001  4096 May 28 17:06 wddxdrwxr-xr-x.  4 1001 1001  4096 Jun 15 00:31 xmldrwxr-xr-x.  5 1001 1001  4096 Jun 15 00:31 xmlreaderdrwxr-xr-x.  4 1001 1001  4096 May 28 17:06 xmlrpcdrwxr-xr-x.  5 1001 1001  4096 Jun 15 00:31 xmlwriterdrwxr-xr-x.  3 1001 1001  4096 May 28 17:06 xsldrwxr-xr-x.  5 1001 1001  4096 May 28 17:06 zipdrwxr-xr-x.  3 1001 1001  4096 May 28 17:06 zlib
登录后复制


在php.ini中有关extension_dir的都是注释掉了的,但是查看phpinfo却有mysql pdo 这些全都显示。



回复讨论(解决方案)

print_r(get_extension_funcs('mbstring'));
看看都有哪些函数

print_r(get_extension_funcs('mbstring'));
看看都有哪些函数



空的。

那就是没有加载了!
加载了的话应显示

Array(    [0] => mb_convert_case    [1] => mb_strtoupper    [2] => mb_strtolower    [3] => mb_language    [4] => mb_internal_encoding    [5] => mb_http_input    [6] => mb_http_output    [7] => mb_detect_order    [8] => mb_substitute_character    [9] => mb_parse_str    [10] => mb_output_handler    [11] => mb_preferred_mime_name    [12] => mb_strlen    [13] => mb_strpos    [14] => mb_strrpos    [15] => mb_stripos    [16] => mb_strripos    [17] => mb_strstr    [18] => mb_strrchr    [19] => mb_stristr    [20] => mb_strrichr    [21] => mb_substr_count    [22] => mb_substr    [23] => mb_strcut    [24] => mb_strwidth    [25] => mb_strimwidth    [26] => mb_convert_encoding    [27] => mb_detect_encoding    [28] => mb_list_encodings    [29] => mb_encoding_aliases    [30] => mb_convert_kana    [31] => mb_encode_mimeheader    [32] => mb_decode_mimeheader    [33] => mb_convert_variables    [34] => mb_encode_numericentity    [35] => mb_decode_numericentity    [36] => mb_send_mail    [37] => mb_get_info    [38] => mb_check_encoding    [39] => mb_regex_encoding    [40] => mb_regex_set_options    [41] => mb_ereg    [42] => mb_eregi    [43] => mb_ereg_replace    [44] => mb_eregi_replace    [45] => mb_ereg_replace_callback    [46] => mb_split    [47] => mb_ereg_match    [48] => mb_ereg_search    [49] => mb_ereg_search_pos    [50] => mb_ereg_search_regs    [51] => mb_ereg_search_init    [52] => mb_ereg_search_getregs    [53] => mb_ereg_search_getpos    [54] => mb_ereg_search_setpos    [55] => mbregex_encoding    [56] => mbereg    [57] => mberegi    [58] => mbereg_replace    [59] => mberegi_replace    [60] => mbsplit    [61] => mbereg_match    [62] => mbereg_search    [63] => mbereg_search_pos    [64] => mbereg_search_regs    [65] => mbereg_search_init    [66] => mbereg_search_getregs    [67] => mbereg_search_getpos    [68] => mbereg_search_setpos)
登录后复制

那就是没有加载了!
加载了的话应显示



安装解压缩放在 /home/default7/LAMP/php-5.5.13
准备安装在目录 /usr/local/php5

我现在的一个疑问点,对linux ./configure:
如果我第一次在解压缩目录中 ./configure --prefix=... && make && make test && make install …… 安装了。
1)那么我需要新增扩展,是仍旧到这个解压缩目录来./configure --prefix=.. && make && make install 重新编译吗?
2)如果是这样,那么我非首次对这个解压缩文件夹 ./configure ,他参数是否必须全部带齐(是不是这个目录有记忆功能)

我没做过,不好说
网上的教程很多,多看看吧

我没做过,不好说
网上的教程很多,多看看吧



后来安装可以了,重新./configure 安装。
不过要先 make clean,感觉解压缩后./configure了的目录会记忆安装过程。
重新安装带上了 --enable-mbstring之后可以了。之前也重装了几次,但是没有make clean,可能是这个原因。

make clean
./configure --prefix=/usr/local/php5
make
make test
make install

phpinfo();
?>
看看有没有mbstring,如果没有,请检查php.ini

本站声明
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系admin@php.cn

热AI工具

Undresser.AI Undress

Undresser.AI Undress

人工智能驱动的应用程序,用于创建逼真的裸体照片

AI Clothes Remover

AI Clothes Remover

用于从照片中去除衣服的在线人工智能工具。

Undress AI Tool

Undress AI Tool

免费脱衣服图片

Clothoff.io

Clothoff.io

AI脱衣机

Video Face Swap

Video Face Swap

使用我们完全免费的人工智能换脸工具轻松在任何视频中换脸!

热工具

记事本++7.3.1

记事本++7.3.1

好用且免费的代码编辑器

SublimeText3汉化版

SublimeText3汉化版

中文版,非常好用

禅工作室 13.0.1

禅工作室 13.0.1

功能强大的PHP集成开发环境

Dreamweaver CS6

Dreamweaver CS6

视觉化网页开发工具

SublimeText3 Mac版

SublimeText3 Mac版

神级代码编辑软件(SublimeText3)

热门话题

Java教程
1664
14
CakePHP 教程
1422
52
Laravel 教程
1316
25
PHP教程
1267
29
C# 教程
1239
24
win10打开游戏fatal error怎么办? win10打开游戏fatal error怎么办? Feb 09, 2024 pm 12:54 PM

win10打开游戏fatalerror怎么办?我们在运行软件或者是游戏的时候会出现提示fatalerror错误怎么办?下面就让本站来为用户们来仔细的介绍一下win10打开游戏fatalerror的处理办法吧。win10打开游戏fatalerror怎么办?方法一:游戏客户端存在了问题,例如文件的损坏或者使用了一些破解补丁,都会导致fatalerror错误的出现,大家可以重新下载游戏。方法二:电脑内存太小也会导致fatalerror错误的出现,如果是物理内存足够的话,那么可以尝试设置一下系统的虚拟内

PHP Fatal error: Call to undefined method PDO::prepare() in的解决方法 PHP Fatal error: Call to undefined method PDO::prepare() in的解决方法 Jun 22, 2023 pm 06:40 PM

PHP作为一种流行的Web开发语言,已经被使用了很长时间。PHP中集成的PDO(PHP数据对象)类是我们在开发Web应用程序过程中与数据库进行交互的一种常用方法。但是,一些PHP开发者经常遇到的问题是,当使用PDO类与数据库进行交互时,他们会收到这样的错误:PHPFatalerror:CalltoundefinedmethodPDO::prep

在Vue应用中使用axios时出现“Uncaught (in promise) Error: Request failed with status code 500”怎么办? 在Vue应用中使用axios时出现“Uncaught (in promise) Error: Request failed with status code 500”怎么办? Jun 24, 2023 pm 05:33 PM

在Vue应用中使用axios是十分常见的,axios是一种基于Promise的HTTP客户端,可以用于浏览器和Node.js。在开发过程中,有时会出现“Uncaught(inpromise)Error:Requestfailedwithstatuscode500”的错误提示,对于开发者来说,这个错误提示可能有些难以理解和解决。本文将会探讨这

最终幻想7fatal error怎么解决 最终幻想7fatal error怎么解决 Mar 07, 2024 pm 04:40 PM

玩家在最终幻想7中进行游戏时,有很多玩家遇到了fatalerror的问题不知道怎么解决,通常是关于内存不能读取的问题,建议玩家尝试重装游戏解决。最终幻想7fatalerror怎么解决1、重装游戏游戏客户端问题,如文件损坏,不完整,使用了一些破解补丁都会导致致命错误的出现,建议重装游戏。2、把所有文件属性的只读去掉某些文件属性不该是只读而设置成了只读,把所有文件属性的只读去掉就行了,比如一款游戏不能玩,那么右键点击该游戏的安装文件夹,取消只读属性。3、设置虚拟内存可能是由于内存太小,如果物理内存足

0271:real time clock error开不开机怎么办 0271:real time clock error开不开机怎么办 Mar 13, 2023 am 11:30 AM

“0271:real time clock error”开不开机的解决办法:1、按一下F1,在出现的界面中,将选项栏转到第三项“Date/Time”;2、将系统时间手动修改成现在的时间;3、按F10,在弹出的对话框中,选择yes;4、重新打开笔记本即可正常开机。

解决C++代码中出现的'error: expected initializer before 'datatype'”问题 解决C++代码中出现的'error: expected initializer before 'datatype'”问题 Aug 25, 2023 pm 01:24 PM

解决C++代码中出现的“error:expectedinitializerbefore'datatype'”问题在C++编程中,有时候我们在编写代码时会遇到一些编译错误,其中一种常见的错误是“error:expectedinitializerbefore'datatype'”。这个错误通常在变量声明或函数定义中发生,可能导致程序无法正确编译或

解决C++代码中出现的'error: incomplete type is not allowed”问题 解决C++代码中出现的'error: incomplete type is not allowed”问题 Aug 26, 2023 pm 08:54 PM

解决C++代码中出现的“error:incompletetypeisnotallowed”问题在C++的编程过程中,有时候会遇到一些编译错误,其中一个常见的错误是“error:incompletetypeisnotallowed”。这个错误通常是由于在使用不完整的类型进行操作时引起的。本文将介绍这个错误的原因,并提供几种解决方法。首先,我

PHP Notice: Undefined property: 的解决方法 PHP Notice: Undefined property: 的解决方法 Jun 22, 2023 pm 02:48 PM

在使用PHP编写代码时,我们可能会遇到“Notice:Undefinedproperty”这个错误提示。这个错误提示意味着我们正在访问一个未定义的属性,通常是因为该属性在代码中尚未被初始化。那么,该如何解决这个问题呢?下面是几种可能的解决方法:初始化属性这是解决该问题的最简单方法。在代码中显式地初始化属性,可以确保它在使用前已经被定义。例如:class

See all articles