ID:               45338
 Comment by:       simonclur at gmail dot com
 Reported By:      tpeterson at americaschoice dot org
 Status:           Open
 Bug Type:         *Configuration Issues
 Operating System: Windows NT
 PHP Version:      5.2.6
 New Comment:

PHP v5.2.6 requires to the php_mysql.dll (v5.2.6) dll to connect to
MySql. 

It appears the PHP v5.2.6 .msi installation package apparently does not
copy the new php_mysql.dll into the ./ext directory as it is supposed
to.

Download the .zip version of php v5.2.6 and copy the php_mysql.dll file
from the zip archive to your /php/ext folder and make sure the following
line in your php.ini file is uncommented.

extension=php_mysql.dll

If you're having problems with "Unable to initialize module" for
php_mysql.dll then you have copied an incorrect version from a previous
or later release of php.

The php_mysql.dll file properties should show the following version
information for the dll:
File version: 5.2.6
Created: 11 January 2006 18h15


Previous Comments:
------------------------------------------------------------------------

[2008-06-23 17:54:13] tpeterson at americaschoice dot org

Description:
------------
I have installed Apache 2.2.9, PHP 5.2.6, and MySQL 5.0 on Windows. PHP
and Apache work. PHP and MySQL do not. But, MySQL does work on its own.


I used the PHP installer for php.net downloads page. 

I keep getting the Fatal error: Call to undefined function
mysql_connect() in C:\Program Files\Apache Software
Foundation\Apache2.2\htdocs\processex.php on line 15 error when I try to
connect to my MySQL database from a PHP script.

I did the following:
1) Installed Apache, PHP, and MySQL
2) Ensured that I can run a PHP with built-in functions and display it
in my browser with Apache serving it up.
3) Log into MySQL and create a database.
4) Located the extensions path my php.ini file and ensured that my
.dlls were in it
5) Located the mysql extension statements in the php.ini file and
uncommented them (removed the semicolon before each of them EVEN THOUGH
THE MYSQL ONES WERE ALREADY UNCOMMENTED IN THIS DOWNLOAD ALTHOUGH YOU
SAY THERE IS NOT BUILT IN SUPPORT).
6) Ensured that both PHP and MySQL have entries in the System Path. 
7) Restarted the server
8) Restarted my computer. 

I got the same error. I looked at the phpinfo() and used
get_loaded_extensions() function output but saw that mysql is not
installed.

Then I did what the documentation in several places on the internet
said to do:
I deleted all the libmysql.dll and php_mysql.dll files except the ones
in the php directory and then copied them to the windows/system32
directory and restarted my computer. I still get the same error message.
Still do not see mysql installed with the phpinfo() or
get_loaded_extensions(). 

I then did the following, which is what another user suggested:
Download the PHP zip distribution and copy the .dlls out of that into
my php directory that the installer installed. No luck. I still get the
same error message.Still do not see mysql installed with the phpinfo()
or get_loaded_extensions(). 

I also tried to load php_mysql.dll with the dl() function but no luck
as I am using a multi-threaded server. 

Someone on the internet said to try deleting the php_mysql.dll and
libmysql.dll and using the ones from MySQL. I just checked and mysql is
only offering mysqli and a replacement for libmysql which I do not want
to get into just yet. 

I can get this installed (WAMP) and working if I use, for example,
xampp. So this tells me there is something wrong with your PHP
code/documentation. 

I am not the only one who has tried. I was teaching a class and all the
students tried individually at school and at home with no luck. I tried
this on my Windows XP and Windows NT laptops. Nothing. 


Reproduce code:
---------------
// we connect to example.com and port 3307
$link = mysql_connect('localhost', 'root', 'password');
if (!$link) {
    die('Could not connect: ' . mysql_error());
}
echo 'Connected successfully';
mysql_close($link);

Expected result:
----------------
That I get "Connected successfully" and that the MySQL PHP module shows
up in the phpinfo() page. 



------------------------------------------------------------------------


-- 
Edit this bug report at http://bugs.php.net/?id=45338&edit=1

Reply via email to