roneill18901 Posted September 19, 2006 Share Posted September 19, 2006 I am having problems get PHP code to connect to MYSQL DatabaseEnvironment:Windows 2000 Advance ServerIIS 5.0MySQL - Server Version 5.0.24a-community-ntPHP5 (Windows NT 5.0 build 2195) Build data Aug 23 2006Steps1. Install MySQL - Server Version 5.0.24a-community-nt2. Configure and issue some baisc queries against system (Example: create database, create table....)3. Install PHP5 (Windows NT 5.0 build 2195) Build data Aug 23 20064. Create test page with phpinfo() function call5. Hit test page with browser - page returns: System Windows NT ODCOMMUNITY 5.0 build 2195 Build Date Aug 23 2006 16:31:18 Configure Command cscript /nologo configure.js "--enable-snapshot-build" "--with-gd=shared" Server API ISAPI Virtual Directory Support enabled Configuration File (php.ini) Path c:\php\php.ini 6. Create a database call phpbb in MySQL 5 database7. Create a user called phpbbuser and Grant rights to phpbb database8. Create another test page: <?php @mysql_connect("localhost","phpbbuser","password") or die("phpbbuser could not connect to MySQL server!"); echo mysql_get_server_info(); @MYSQL_select_db("phpbb") or die("Could not select phpbb database"); echo "You connected to the MySQL database!"; @mysql_close(); ?>9. Turn on Error display in php.ini 10. Hit page from browser and get the following error message: Fatal error: Call to undefined function mysql_connect() in c:\Inetpub\wwwroot\testdb2.php on line 10I have set the following:PHP INISession VariableExtension DirectoryCGI.Force_RedirectPHP_MYSQL.DLLDoc_ROOT is set to inetpub\wwwrootSystemSystem path to c:\phpEnvironmental Variable PHPRC to c:\phpIISIsapi extension is setup for PHP5ISAPI.DLLAny Suggestions? Quote Link to comment Share on other sites More sharing options...
wildteen88 Posted September 20, 2006 Share Posted September 20, 2006 YOu need to edit the php.ini to enable the mysql extension (php_mysql.dll). Have a read of [url=http://www.phpfreaks.com/forums/index.php/topic,95378.0.html]this FAQ[/url] in our FAQ/Code Snippet Repository forum to see how to enable the extension.NOTE: if you have enabled the MySQL Improved extension (php_mysqli.dll) you'll want to enable the standard mysql extension (php_mysql.dll) too! Quote Link to comment Share on other sites More sharing options...
roneill18901 Posted September 20, 2006 Author Share Posted September 20, 2006 Yes I have done that. Set the correct extension directory and removed the semi-colon from the line in the ini file for the mysql dll. Any other suggestions? Quote Link to comment Share on other sites More sharing options...
wildteen88 Posted September 20, 2006 Share Posted September 20, 2006 Did you restart your server. It is important you restart the server, not the hardware, eg the computer it self, but the server software, eg IIS or Apache or what ever server software you are using.If you did restart the server. check that PHP is using the correct php.ini file.Also if you have changed the Windows PATH variable, you will have to restart your computer for the additon to the PATH variable to come available. Quote Link to comment Share on other sites More sharing options...
roneill18901 Posted September 20, 2006 Author Share Posted September 20, 2006 Done. Numerous time. Quote Link to comment Share on other sites More sharing options...
wildteen88 Posted September 20, 2006 Share Posted September 20, 2006 When you run the phpinfo function, can you find a mysql section anywhere in generated page that phpinfo generates? Also did you use the php installer? Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.