php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Doc Bug #48461 Call to undefined function mysql_connect()
Submitted: 2009-06-03 13:47 UTC Modified: 2009-06-11 01:00 UTC
Votes:5
Avg. Score:4.6 ± 0.8
Reproduced:4 of 5 (80.0%)
Same Version:3 (75.0%)
Same OS:3 (75.0%)
From: jonathan at strutt dot co dot uk Assigned:
Status: No Feedback Package: Documentation problem
PHP Version: 5.2.9 OS: Windows Vista Business Eddition
Private report: No CVE-ID: None
Have you experienced this issue?
Rate the importance of this bug to you:

 [2009-06-03 13:47 UTC] jonathan at strutt dot co dot uk
Description:
------------
Using IIS 7 over Windows Vista Business and PHP 5.2.9 in ISAPI mode.

Receive the following error when trying to connect to MySQL database: 

Fatal error: Call to undefined function mysql_connect() in 
S:\northfusion\company\websites\cleverboxed\www\_assets\_includes\class_
db.php on line 16

In addition, when viewing the output of phpinfo(), it states the php.ini 
file being used is c:\windows\php.ini and that the extension library 
location is "./". However, in the c:\windows\php.ini file, the extension  
location is set to "C:\php\ext".

It looks as though this isn't being picked up despite numerous IIS 
restarts.

Reproduce code:
---------------
	//..
	function connect() {

		// bring in config
		global $config;

		// create database handle
		$this->handle = mysql_connect($_config->db->host, $_config->db->username, $config->db->password);

	}
	//..


Expected result:
----------------
Open connection to the database

Actual result:
--------------
Returned error:

Fatal error: Call to undefined function mysql_connect() in 
S:\northfusion\company\websites\cleverboxed\www\_assets\_includes\class_
db.php on line 16

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2009-06-03 16:53 UTC] jonathan at strutt dot co dot uk
In an interesting development, I've found that when moving the php.ini 
file between c:\php and c:\windows, it magically gets edited!!!

If I edit the file away from the c:\windows dir, I can get php to 
recognise the changes. However, if I move it and edit as an ini file, it 
magically adjusts after the cut and paste and only shows only some of 
the changes made!!

This is getting to be crazy!!
 [2009-06-03 17:04 UTC] jonathan at strutt dot co dot uk
AT LAST! I seem to have resolved the issue....

by placing the libmysql.dll in the c:\windows\system32 directory along 
with the php_mysql.dll file.

I hasten to point out, this isn't the first time I've tried doing this, 
but this time I stopped the IIS7 server, moved the files, the started it 
again and it seems to have worked. This also seems to prevent the 
mystery changing of the ini file. And I don't think it's fixed the 
problem persay - the extension_dir is still c:\php\ext in the ini file, 
so either php isn't loading the extension from there, or the files need 
to be duplicated somewhere else for it to work!?!?!?
 [2009-06-03 20:58 UTC] philip@php.net
Please have a look at the following, and determine if the documentation 
is correct:

- http://php.net/manual/en/mysql.installation.php

The same goes for php.ini, please determine if the following are 
correct:

- http://php.net/manual/en/faq.installation.php#faq.installation.phprc
- http://php.net/manual/en/configuration.file.php

 [2009-06-11 01:00 UTC] doc-bugs at lists dot php dot net
No feedback was provided for this bug for over a week, so it is
being suspended automatically. If you are able to provide the
information that was originally requested, please do so and change
the status of the bug back to "Open".
 
PHP Copyright © 2001-2020 The PHP Group
All rights reserved.
Last updated: Sat Jul 04 15:01:26 2020 UTC