Thoughts on the configuration solution when php cannot load the mysql module_PHP Tutorial

WBOY
Release: 2016-07-21 15:21:22
Original
738 people have browsed it

之后看phpinfo() 里 确实也没找到mysql 模块, 之后所谓的解决方案如“将php.ini” 放入C:\Windows 环境变量等不靠谱说法。。。。。

甚至拷贝ext的文件夹的dll 到System32 中等

统统不靠谱 直到看到这篇帖子,我才发现问题

http://www.haosblog.com/index.php?mod=article_read&id=322

“mysql无法找到的原因是mysql的运行库无法找到,打开mysql的安装文件夹,在bin文件夹中找到libmySQL.dll,将它复制到system32文件夹中,让mysql的运行库能在系统中注册,然后重启Apache”

我是在\MySQL\MySQL Server 5.5\lib目录里找到的

实际上在自己配置的时候应该发现不是环境变量或者是没有加载到php.ini 或者没加载到extension的

为什么这么说呢

首先,在Apache 的配置中 已经添加了php的配置路径

image

同时phpinfo()也显示的加载到了,有兴趣的同学可以试试php.ini  存在和不存在的时候的区别

 

image

 

其次,自己在php.ini里确实配置了extension_dir 的,如果这个东西没意义,那何必在配置文件里有这个选项?之后这里注意一下,他的分隔符和apache 刚好相反   是“\”

image 

之后php 也顺利加载了 

 

image

所以,其实完全可以避免自己跟着瞎折腾的,结果大意了。

PHP配置成功后phpinfo中找不到mysql

不少新人使用Apache+PHP+MySql配置好PHP环境都会遇到一个问题:mysql无法使用,使用phpinfo()函数获取的信息中也找不到mysql。
网上不少资料都说要把php.ini转移到windows或者system32文件夹中,这是胡扯!如果你把php和php/ext的目录添加到了环境变量中是不需要这么设置的。这么做的原因是Apache会到默认路径中查找配置文件,而没有设置环境变量的话Apache就找不到php.ini了。你可以看看phpinfo()页面中搜索php.ini,php.ini的路径是windows那么就把PHP的路径写入环境变量中,环境变量的设置可上网查找一下,尽量不要将php.ini放入系统文件夹中,对系统盘的操作要越少越好。
mysql无法找到的原因是mysql的运行库无法找到,打开mysql的安装文件夹,在bin文件夹中找到libmySQL.dll,将它复制到system32文件夹中,让mysql的运行库能在系统中注册,然后重启Apache,打开phpinfo()页面,搜索mysql,结果如下图
Thoughts on the configuration solution when php cannot load the mysql module_PHP Tutorial

Then congratulations, mysql can now run normally in your PHP.
Many newcomers will be troubled by this problem. I was also troubled by it for a long time. The information on the Internet all said to copy php.ini to the system disk, but it was still useless. Here is a serious BS on those who only copy other people's articles without taking actual actions. A lot of wrong information is spread by them and misleads many newcomers. I am seriously despised!

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/324895.htmlTechArticleAfter looking at phpinfo(), I did not find the mysql module. Then the so-called solution was such as "change php.ini ” Unreliable statements such as putting it in C:Windows environment variables. . . . . Even copy ex...
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!