<span style="font-family: Simsun; font-size: 14px; line-height: 21px; ">配置的PHP环境,或者刚做过配置改动,比如新加载的DLL扩展,访问页面,可能会出现“内存位置访问无效。”的错误。主要原因是DLL扩展加载失败。</span><br style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; font-family: Simsun; font-size: 14px; line-height: 21px; " /><span style="font-family: Simsun; font-size: 14px; line-height: 21px; "> 我们就需要找到是哪一个DLL文件加载出现了问题。排查方法是:</span><br style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; font-family: Simsun; font-size: 14px; line-height: 21px; " /><span style="font-family: Simsun; font-size: 14px; line-height: 21px; "> 将php.ini中 display_startup_errors = Off 改为display_startup_errors = On 。</span><br style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; font-family: Simsun; font-size: 14px; line-height: 21px; " /><span style="font-family: Simsun; font-size: 14px; line-height: 21px; "> 这是访问php页面,</span><span style="color:red;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; font-family: Simsun; font-size: 14px; line-height: 21px; ">服务器上</span><span style="font-family: Simsun; font-size: 14px; line-height: 21px; ">会弹出php错误的提示对话框,你就可以明确看到是哪一个dll文件加载失败,有时会有多个dll文件加载失败,需要你先分号(;)注释掉php.ini中提示那个dll后继续访问如此反复排查。</span><br style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; font-family: Simsun; font-size: 14px; line-height: 21px; " /><span style="font-family: Simsun; font-size: 14px; line-height: 21px; "> 把出问题的dll都用分号(;)注释掉后,php就可以正常运行了。</span><br style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; font-family: Simsun; font-size: 14px; line-height: 21px; " /><span style="font-family: Simsun; font-size: 14px; line-height: 21px; "> 如果加载失败的dll是你必须使用的扩展库文件,那么就要从版本是否对应、文件是否齐全、文件是否已损坏等等方面去排查加载失败的原因了。不同的扩展具有不同的情况,这里就无法一一罗列了,记住:搜索引擎是你最好的帮手,针对单个dll去搜索解决的方法吧。</span><br style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; font-family: Simsun; font-size: 14px; line-height: 21px; " /><span style="font-family: Simsun; font-size: 14px; line-height: 21px; "> </span><span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; font-family: Simsun; font-size: 14px; line-height: 21px; ">另外:</span><span style="font-family: Simsun; font-size: 14px; line-height: 21px; ">新版本的Windows版本PHP,在出现错误时,会将详细的错误信息自动存储到Windows系统的TEMP临时目录,文件名为:php-errors.log。在Windows2003系统中路径一般是:C:\WINDOWS\Temp\php-errors.log。用记事本打开这个文件,就可以看到详细的php错误记录了。</span><br style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; font-family: Simsun; font-size: 14px; line-height: 21px; " /><br style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; font-family: Simsun; font-size: 14px; line-height: 21px; " /><span style="color:red;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; font-family: Simsun; font-size: 14px; line-height: 21px; "><span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; ">此处往下是从网上转载的内容:</span></span><br style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; font-family: Simsun; font-size: 14px; line-height: 21px; " /><span style="font-family: Simsun; font-size: 14px; line-height: 21px; "> 客户一个PHP网站每天早上都访问不了,提示“内存位置访问无效”,重启IIS无效,要重启服务器才能暂时正常,过一会儿又是出现这个“内存位置访问无效”的提示。</span><br style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; font-family: Simsun; font-size: 14px; line-height: 21px; " /><span style="font-family: Simsun; font-size: 14px; line-height: 21px; "> 到百度上搜索了一下,找到解决方法,在此记录一下:</span><br style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; font-family: Simsun; font-size: 14px; line-height: 21px; " /><span style="font-family: Simsun; font-size: 14px; line-height: 21px; "> 打开c:\windows\php.ini文件,搜索下面的字段</span><br style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; font-family: Simsun; font-size: 14px; line-height: 21px; " /><span style="font-family: Simsun; font-size: 14px; line-height: 21px; "> extension=php_exif.dll</span><br style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; font-family: Simsun; font-size: 14px; line-height: 21px; " /><span style="font-family: Simsun; font-size: 14px; line-height: 21px; "> 找到后在前面加一个;分号注释掉</span><br style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; font-family: Simsun; font-size: 14px; line-height: 21px; " /><span style="font-family: Simsun; font-size: 14px; line-height: 21px; "> 如下:</span><br style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; font-family: Simsun; font-size: 14px; line-height: 21px; " /><span style="font-family: Simsun; font-size: 14px; line-height: 21px; "> ;extension=php_exif.dll</span><br style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; font-family: Simsun; font-size: 14px; line-height: 21px; " /><span style="font-family: Simsun; font-size: 14px; line-height: 21px; "> 保存重启iis再访问一下php文件看看能否打开了,没有出现内存位置访问无效了。</span><br style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; font-family: Simsun; font-size: 14px; line-height: 21px; " /><br style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; font-family: Simsun; font-size: 14px; line-height: 21px; " /><span style="font-family: Simsun; font-size: 14px; line-height: 21px; "> 以上操作实际上是把php_exif.dll组件禁用了。如果一定要用到这个组件可以试试下面这个方法:</span><br style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; font-family: Simsun; font-size: 14px; line-height: 21px; " /><span style="font-family: Simsun; font-size: 14px; line-height: 21px; "> 一、将IIS的错误显示打开,未发现错误原因</span><br style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; font-family: Simsun; font-size: 14px; line-height: 21px; " /><span style="font-family: Simsun; font-size: 14px; line-height: 21px; "> 二、检查IIS扩展,ISAPI、php.ini与Mysql配置以及相应的安装目录ACLs权限,均无误。</span><br style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; font-family: Simsun; font-size: 14px; line-height: 21px; " /><span style="font-family: Simsun; font-size: 14px; line-height: 21px; "> 三、回收IIS进程,错误仍然出现”内存位置访问无效”….</span><br style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; font-family: Simsun; font-size: 14px; line-height: 21px; " /><span style="font-family: Simsun; font-size: 14px; line-height: 21px; "> 四、将php.ini中 display_startup_errors = On 打开,问题所在终于发现了… (注:如果将php.ini的display_startup_errors打开,如果php有错误出理,就会提示,而且 在事件查看器中有记录。如果设置为display_startup_errors = Off,则不会有任何提示)</span><br style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; font-family: Simsun; font-size: 14px; line-height: 21px; " /><span style="font-family: Simsun; font-size: 14px; line-height: 21px; "> 五、Warning Cannot load module ‘SQLite’ because required module ‘pdo’ is no loaded</span><br style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; font-family: Simsun; font-size: 14px; line-height: 21px; " /><span style="font-family: Simsun; font-size: 14px; line-height: 21px; "> 六、根据以上错误提示,解决办法就很简单了,因为加载php_sqlite.dll时未加载到php_pdo.dll文件,所以运行phpinfo()函数时提示内存 位置访问无效。</span><br style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; font-family: Simsun; font-size: 14px; line-height: 21px; " /><span style="font-family: Simsun; font-size: 14px; line-height: 21px; "> 找到php.ini配置文件,然后去掉”;extension=php_pdo.dll”前面的分号,extension=php_sqlite.dll</span><br style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; font-family: Simsun; font-size: 14px; line-height: 21px; " /><span style="font-family: Simsun; font-size: 14px; line-height: 21px; "> 然后再回收一下IIS应用程序池进程,问题彻底解决….</span>