|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2008-05-10 22:57 UTC] jani@php.net
[2008-05-14 07:22 UTC] sudakadam at gmail dot com
[2008-05-14 13:04 UTC] jmertic@php.net
[2008-05-14 21:04 UTC] Zian dot Choy at gmail dot com
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Mon Nov 03 03:00:01 2025 UTC |
Description: ------------ Viewing a PHP file that attempts to connect to MySQL results in a HTTP 500. Reproduce code: --------------- 1. Install the latest version of Apache using the Windows installer with Open SSL, using all defaults 2. Stop Apache 3. Install the latest version of PHP using the MSI. In the configuration of the PHP install... 1. Pick "Apache 2.2" 2. Point the installer at Apache's conf directory 3. Under "Extensions," select MySQL and MySQLi 4. Start Apache 5. Start MySQL 6. Run the following code inside a file: <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <head> <title>SQL Test</title> </head> <body> <?php $dbServer='localhost'; // username and password $dbUser='[root username]'; $dbPass='[password]'; // name of database $dbName='test'; $link = mysql_connect("$dbServer", "$dbUser", "$dbPass") or die("Could not connect"); print "Connected successfully<br>"; mysql_select_db("$dbName") or die("Could not select database"); print "Database selected successfully<br>"; mysql_close($link); ?> </body> </html> Expected result: ---------------- I expected to see: Connected successfully Database selected successfully Actual result: -------------- The IE7 HTTP 500 error screen and the following entry in the Apache error.log file: [Fri May 09 22:03:08 2008] [error] [client 127.0.0.1] PHP Fatal error: Call to undefined function mysql_connect() in C:\\Program Files\\Apache Software Foundation\\Apache2.2\\htdocs\\sql.php on line 14