Urgent and urgent php connection to mysql

Source: Internet
Author: User
Urgent and urgent php connection to mysql problems win7 flagship version + php5.3.6 + mysql5.5.10 + Apache2.2.7 configuration, mysql and php are good, but I don't know what's going on, php cannot connect to mysql, as for php. I also removed the semicolons in ini.
Extension = php_gd2.dll
Extension = php_mbstring.dll
Extension = php_mysql.dll
Extension = php_mysqli.dll
After a file is written to connect to mysql, the following error occurs when running in the php environment:
Fatal error: Call to undefined function mysql_connect () in F: \ Localhost \ mysql_connect.php on line 6
The database file has been confirmed to be correct. hope you guys can help me find a solution. please be in a hurry !!!!


Reply to discussion (solution)

Phpinfo () is used to list PHP configurations and check whether mysql configuration parameters exist;
Check whether the php. ini file is modified for you;
Check whether the php_mysql.dll Extension folder exists.

Phpinfo () is used to list PHP configurations and check whether mysql configuration parameters exist;
Check whether the php. ini file is modified for you;
Check whether the php_mysql.dll Extension folder exists.
The phpinfo () mysql part is like this. it seems that the version is my previous version. I used mysql 5.0 in the past and now I have changed it to version 5.5.10.
Mysqlnd
Mysqlnd enabled
Version mysqlnd 5.0.8-dev-20102224-$ Revision: 308673 $
Compression supported
SSL supported
Command buffer size 4096
Read buffer size 32768
Read timeout 31536000
Collecting statistics Yes
Collecting memory statistics Yes
Tracing n/

Phpinfo () is used to list PHP configurations and check whether mysql configuration parameters exist;
Check whether the php. ini file is modified for you;
Check whether the php_mysql.dll Extension folder exists.
"Check if php_mysql.dll exists in the Extension folder". Where can I find it? I never encountered this during installation.

Http://download.csdn.net/source/2558379give you a fast integrated installation

Check if there is any original MYSQL program. If yes, close it. the mysql running on the PHP server should be okay !!

On line 6? Paste it to see the connection you wrote --!

On line 6? Paste it to see the connection you wrote --! $ Dbhost = 'localhost ';
$ Dbuser = 'root'; // mysql username
$ Dbpass = 'root'; // mysql password
$ Dbname = 'training'; // mysql database name
$ Link = mysql_connect ($ dbhost, $ dbuser, $ dbpass );
If (! $ Link) echo "fail ";
Else echo "success ";
Mysql_close ();
?>
I tried it out to a friend yesterday, and the running result was success. I also read his php configuration file, which is the same as mine, but we use different mysql versions, his 5.1, my 5.5, is mysql version different? php. is the configuration of ini different?

Http://download.csdn.net/source/2558379!

Check if there is any original MYSQL program. If yes, close it. the mysql running on the PHP server should be okay !! Can you make it clear? Not very clear

Is it my problem: http://blog.csdn.net/tgh1981/archive/2011/04/27/6366067.aspx
Mysql database connection problems, difficult to solve...

Extension = php_mysql.dll
Extension = php_mysqli.dll
Copy to window \ system32. try

Post the error. log file in the log folder under your APACHE installation directory

Extension = php_mysql.dll
Extension = php_mysqli.dll
Copy to window \ system32. try again, no use.

Put the error in the log folder under your APACHE installation directory. post the log file to PHP Warning: PHP Startup: Unable to load dynamic library 'C: \ php \ php_curl.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


Warning: PHP Startup: Unable to load dynamic library 'C: \ php \ php_curl.dll '-the specified module cannot be found.

InUnknownOn line0

PHP Warning: PHP Startup: Unable to load dynamic library 'C: \ php \ php_gd2.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


Warning: PHP Startup: Unable to load dynamic library 'C: \ php \ php_gd2.dll '-the specified module cannot be found.

InUnknownOn line0

PHP Warning: PHP Startup: Unable to load dynamic library 'C: \ php \ php_mbstring.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


Warning: PHP Startup: Unable to load dynamic library 'C: \ php \ php_mbstring.dll '-the specified module cannot be found.

InUnknownOn line0

PHP Warning: PHP Startup: Unable to load dynamic library 'C: \ php \ php_mysql.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


Warning: PHP Startup: Unable to load dynamic library 'C: \ php \ php_mysql.dll '-the specified module cannot be found.

InUnknownOn line0

PHP Warning: PHP Startup: Unable to load dynamic library 'C: \ php \ php_mysqli.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


Warning: PHP Startup: Unable to load dynamic library 'C: \ php \ php_mysqli.dll '-the specified module cannot be found.

InUnknownOn line0

PHP Warning: PHP Startup: Unable to load dynamic library 'C: \ php \ php_pdo_mysql.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


Warning: PHP Startup: Unable to load dynamic library 'C: \ php \ php_pdo_mysql.dll '-the specified module cannot be found.

InUnknownOn line0

PHP Warning: PHP Startup: Unable to load dynamic library 'C: \ php \ php_pdo_odbc.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


Warning: PHP Startup: Unable to load dynamic library 'C: \ php \ php_pdo_odbc.dll '-the specified module cannot be found.

InUnknownOn line0

PHP Warning: PHP Startup: Unable to load dynamic library 'C: \ php \ php_xmlrpc.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


Warning: PHP Startup: Unable to load dynamic library 'C: \ php \ php_xmlrpc.dll '-the specified module cannot be found.

InUnknownOn line0
Why can't I find the specified module?

Try using mysqli_connect (). you can see if the configuration file of your php. ini in the system has been modified. or check whether mysql is supported in phpinfo (); disable?

Dude, I think it's a problem with your php version. it's not only about IPVs and unix, but also about multithreading. although I'm a newbie, I 've configured the environment for two weeks before I can give my software name. you see
Apache: httpd-2.2.17-win32-x86-openssl-0.9.8o.msi
Mysql: mysql-5.5.10-win32.msi
Php: php-5.2.17-Win32-VC6-x86.zip
Among them, php is divided into VC6 and VC9. you can see what your situation is. go to the official website and take a look at the Chinese on the left. upload my installation file to you
I think vista is similar to yours.

After removing the dll file, you also need to set it in win7 to allow the operating system to find the dll file.
The method is as follows:
Right-click "computer"-> Properties-> Advanced System Settings-> Select "Advanced tab"-> "environment variables" in the lower right corner-> select Path in the following system variable box, click edit->
Add "; C: \ PHP \ ext" to the variable value (excluding parentheses)
(My php is installed in the c root directory, so if you load program files, you should write "; C: \ Program Files \ PHP; C: \ Program Files \ PHP \ ext ")
Note: Do not delete the original variable value, but add it after the variable value.
Then restart the instance to make it take effect only after it is restarted.

Correct the error:
Select the "Advanced" tab->

[Quote = reference the reply from gimli on the 19th floor:]
Correct the error:
Select the "Advanced" tab->
[/Quote prawn, no use. I still cannot change the environment variable.

After removing the dll file, you also need to set it in win7 to allow the operating system to find the dll file.
The method is as follows:
Right-click "computer"-> Properties-> Advanced System Settings-> Select "Advanced tab"-> "environment variables" in the lower right corner-> select Path in the following system variable box, click edit->
Add "; C: \ PHP \ ext" to the variable value (excluding parentheses)
(My php is installed in the c root directory, so if you load program files, you should write ";...... Can I restart my computer or Apache?

In fact, this problem is generally not a problem. You cannot find the mysql module when running phpinfo.
Search for the php. ini file in C: \ Windows and check the file before extension = php_mysql.dll. Do not create extension = php_m ssql. dll. These two images are compared, and a file must be copied to the system32 directory,
Libmysql. dll, which is found in php. ini:
Extension_dir = "./"
Change it to the absolute path of the ext subdirectory in your php installation directory. For example, my:
Extension_dir = "C:/php/ext /"
This step is important. Otherwise, php cannot find the php_mysql.dll module and cannot load it.
Restart your computer or apache. if you run the phpinfo command containing mysql, the load is successful. Otherwise, the load is successful... You know!

Solved! Hahahaha! It turns out that the semicolon before extension_dir = "F:/php/ext" does not go

Solved! Hahahaha! It turns out that the semicolon before extension_dir = "F:/php/ext" does not go


This is the details! The day has not been completed !!!!

It's amazing !!!

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.