php mysql_connect() 不支持的解决方案
mysql_connect()函数是一个php与mysql数据库连接函数,如果你的php不支持mysql_connect()函数就是你的数据库不能与mysql连接了,下面我来总结一下解决mysql_connect()不能使用的方法。
如果是apache环境我们参考下面办法解决
一、在系统的 system32(C:/windows/system32)目录下缺少libmysql.dll文件,解决方法是找到php目录下的libmysql.dll,并将libmysql.dll复制到C:/ windows/system32目录中,然后重新启动Web服务。
二、在C:/windows目录下的php.ini文件中,没有将“;extension=php_mysql.dll”中的前面一个“;”去掉,所以不能使用相应功能,解决方法是打开php.ini文件找到;extension=php_mysql.dll 改成
extension=php_mysql.dll //去掉前面的;使之生效
三、Mysql目录没有读取权限,正确的目录权限如下:
administrator 完全控制
system 完全控制
users 读取和运行+列出文件夹目录+读取
其他的用户权限全部删除,然后重启MYsql服务和Web服务
(注:以上设置无安全设置;建议修改后重启一下服务器)
重要,还要检查php.ini文件的权限,检查复制到system32里面的php文件的权限,检查php安装目录文件夹的权限.至少要有users默认权限.temp文件夹至少要有users组修改级别权限.
但是,所有的方法都试过了,还是没能解决,于是我搜索了一下mysql_connect()不支持,
把以下代码保存为phpinfo.php:
phpinfo();
?>
如果iis环境我们参考下面办法解决
在整合IIS和PHP时需要注意的:
安装PHP
(1) 解压缩下载的php-5.1.4-Win32.zip文件,并将其复制到:
X:/Server_Core/PHP ;
(2) 进入X:/Server_Core/PHP文件夹,将php.ini-dist 重命名为 php.ini ;
(3) 打开php.ini文件,找到:
extension_dir = "./"
将其改为;
extension_dir = "X:/Server_Core/PHP/ext"
(4) 找到:Windows Extensions
在Windows Extensions下方的动态模块配置中,需要打开以下模块支持:(去掉模块配置每行前面的;号即可)
extension=php_mbstring.dll
extension=php_gd2.dll
extension=php_mysql.dll
(5) 找到:
disable_functions =
改为:
disable_functions =
passthru,exec,system,popen,chroot,escapeshellcmd,escapeshellarg,shell_exec,proc_open,proc_get_status其中第四条:
--------------------------------------------------------------------------------
(4) 找到:Windows Extensions
在Windows Extensions下方的动态模块配置中,需要打开以下模块支持:(去掉模块配置每行前面的;号即可)
extension=php_mbstring.dll
extension=php_gd2.dll
extension=php_mysql.dll ----->就是因为这行前面的分号“;”没去掉才导致上述报错的,即去掉分号,重启一下Apache服务器即可!!!

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics











session_start()iscrucialinPHPformanagingusersessions.1)Itinitiatesanewsessionifnoneexists,2)resumesanexistingsession,and3)setsasessioncookieforcontinuityacrossrequests,enablingapplicationslikeuserauthenticationandpersonalizedcontent.

In MySQL, add fields using ALTERTABLEtable_nameADDCOLUMNnew_columnVARCHAR(255)AFTERexisting_column, delete fields using ALTERTABLEtable_nameDROPCOLUMNcolumn_to_drop. When adding fields, you need to specify a location to optimize query performance and data structure; before deleting fields, you need to confirm that the operation is irreversible; modifying table structure using online DDL, backup data, test environment, and low-load time periods is performance optimization and best practice.

To safely and thoroughly uninstall MySQL and clean all residual files, follow the following steps: 1. Stop MySQL service; 2. Uninstall MySQL packages; 3. Clean configuration files and data directories; 4. Verify that the uninstallation is thorough.

Efficient methods for batch inserting data in MySQL include: 1. Using INSERTINTO...VALUES syntax, 2. Using LOADDATAINFILE command, 3. Using transaction processing, 4. Adjust batch size, 5. Disable indexing, 6. Using INSERTIGNORE or INSERT...ONDUPLICATEKEYUPDATE, these methods can significantly improve database operation efficiency.

MySQL functions can be used for data processing and calculation. 1. Basic usage includes string processing, date calculation and mathematical operations. 2. Advanced usage involves combining multiple functions to implement complex operations. 3. Performance optimization requires avoiding the use of functions in the WHERE clause and using GROUPBY and temporary tables.

Composer is a dependency management tool for PHP, and manages project dependencies through composer.json file. 1) parse composer.json to obtain dependency information; 2) parse dependencies to form a dependency tree; 3) download and install dependencies from Packagist to the vendor directory; 4) generate composer.lock file to lock the dependency version to ensure team consistency and project maintainability.

Use the EXPLAIN command to analyze the execution plan of MySQL queries. 1. The EXPLAIN command displays the execution plan of the query to help find performance bottlenecks. 2. The execution plan includes fields such as id, select_type, table, type, possible_keys, key, key_len, ref, rows and Extra. 3. According to the execution plan, you can optimize queries by adding indexes, avoiding full table scans, optimizing JOIN operations, and using overlay indexes.

The reasons why MySQL is widely used in various projects include: 1. High performance and scalability, supporting multiple storage engines; 2. Easy to use and maintain, simple configuration and rich tools; 3. Rich ecosystem, attracting a large number of community and third-party tool support; 4. Cross-platform support, suitable for multiple operating systems.
