找不到php_mbstring.dll或php_exif.dll的解决方法与mb_系列函数的用法 libmcrypt.dll时出错的处理

来源:互联网 发布:无需网络的手机电视 编辑:程序博客网 时间:2024/05/22 06:26
PHPWarning:  PHPStartup:Unabletoloaddynamic library 'e:/AppServ\php5\ext\php_exif.dll' - 找不到指定的模块。

 in Unknown on line 0

或提示找不到php_mbstring.dll,都可以用下面的方法解决.

mb_开头的函数是为了解决像utf-8这样多字节字符的截取与长度等操作的,如果直接用substr则常出现最后一个字符的乱码(即截取了半个汉字)

首先安装php_mbstring.dll,它是放在php目录的 ext文件夹下的,确保在php.ini文件中加载extension=php_exif.dll前先加载extension=php_mbstring.dll

即:

extension=php_mbstring.dll 在前

extension=php_exif.dll 在后.

否则在命令行启动时总会提示:“找不到php_mbstring.dll”.

下面是使用的一个例子(感觉非常的爽,以前要写很20行解决的文件,现在一个函数就解决了)
<?
header("Content-Type: text/html; charset=utf-8");

$str = '这样一来我的字符串就不会有乱码^_^';
echo "mb_substr:" . mb_substr($str, 0, 7, 'utf-8');
echo "<br>";
echo "mb_strcut:" . mb_strcut($str, 0, 7, 'utf-8');
echo "<br>";
echo "mb_strcut:" . mb_strcut($str, 0, 6, 'utf-8');
/*
输出如下反正不会出现乱码:
mb_substr:这样一来我的字
mb_strcut:这样  (按字节截取,如果不足一个中文的字节,则把这字舍去)
mb_strcut:这样
*/
?>

windows php安装libmcrypt.dll时出错的处理,在apache的logs/error.log里可以看到如下提示:
PHP Warning:  PHP Startup: Unable to load dynamic library 'D:/AppServ/php5/ext\\libmcrypt.dll' - \xd5\xd2\xb2\xbb\xb5\xbd\xd6\xb8\xb6\xa8\xb5\xc4\xc4\xa3\xbf\xe9\xa1\xa3\r\n in Unknown on line 0

处理办法:
 1.在php手册里可以查到libmcrypt.dll是要依赖libmcrypt.dll的,所以
php的目录下找到libmcrypt.dll 把 libmcrypt.dll 放在 system32 文件夹中.
 2.在php.ini中把此行去掉注释.extension=php_mcrypt.dll.
 3.重起apache.再试一下.


Warning: fsockopen() [function.fsockopen]:unable to connectto ssl://open.t.qq.com:443 (Unable to find the socket transport "ssl" - did you forgetto enable it when you configuredPHP?) in D:\test\txPHP-SDK\opent.php on line 216

打开ssl中的: extension=php_openssl.dll

 

 WEB开发类

 50个最受网友欢迎的HTML5资源下载列表

  http://bbs.51cto.com/thread-933835-1.html

17、2012 PHP热门资料64个+经典源码50个——下载目录 
      http://bbs.51cto.com/thread-933810-1.html
18、ASP开发入门+实战电子书共50本
      http://bbs.51cto.com/thread-935556-1.html
19、45个CSS热门资料源码打包下载
     http://bbs.51cto.com/thread-936565-1.html
20、62个ASP免豆资料汇总,欢迎下载~   
      http://bbs.51cto.com/thread-939214-1.html
21 、【PHP资料免豆下载】汇总大量教程+工具+源码下载地址
     http://bbs.51cto.com/thread-939548-1.html 
22、60个JSP免豆资料(教程+源码)下载地址汇总
     http://bbs.51cto.com/thread-939980-1.html 
23、【资料目录收藏】.NET开发必看资料53个+经典源码77个
     http://bbs.51cto.com/thread-933829-1.html 
24、39个jQvery免豆资料地址汇总
      http://bbs.51cto.com/thread-941006-1.html
25、82个Javascript免豆资料下载地址汇总
     http://bbs.51cto.com/thread-941008-1.html 

原创粉丝点击