From: tpeterson at americaschoice dot org Operating system: Windows NT PHP version: 5.2.6 PHP Bug Type: *Configuration Issues Bug description: PHP 5.2.6 does not connect to MySQL
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 bug report at http://bugs.php.net/?id=45338&edit=1 -- Try a CVS snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=45338&r=trysnapshot52 Try a CVS snapshot (PHP 5.3): http://bugs.php.net/fix.php?id=45338&r=trysnapshot53 Try a CVS snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=45338&r=trysnapshot60 Fixed in CVS: http://bugs.php.net/fix.php?id=45338&r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=45338&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=45338&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=45338&r=needscript Try newer version: http://bugs.php.net/fix.php?id=45338&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=45338&r=support Expected behavior: http://bugs.php.net/fix.php?id=45338&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=45338&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=45338&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=45338&r=globals PHP 4 support discontinued: http://bugs.php.net/fix.php?id=45338&r=php4 Daylight Savings: http://bugs.php.net/fix.php?id=45338&r=dst IIS Stability: http://bugs.php.net/fix.php?id=45338&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=45338&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=45338&r=float No Zend Extensions: http://bugs.php.net/fix.php?id=45338&r=nozend MySQL Configuration Error: http://bugs.php.net/fix.php?id=45338&r=mysqlcfg