Jump to content

Archived

This topic is now archived and is closed to further replies.

roneill18901

PHP5 and MYSQL 5 Installation Problem

Recommended Posts

I am having problems get PHP code to connect to MYSQL Database


Environment:

Windows 2000 Advance Server
IIS 5.0
MySQL - Server Version 5.0.24a-community-nt
PHP5 (Windows NT 5.0 build 2195)  Build data Aug 23 2006

Steps

1. Install MySQL - Server Version 5.0.24a-community-nt
2. 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 2006
4. Create test page with phpinfo() function call
5. 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 database
7. Create a user called phpbbuser and Grant rights to phpbb database
8. 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 10

I have set the following:

PHP INI

Session Variable
Extension Directory
CGI.Force_Redirect
PHP_MYSQL.DLL
Doc_ROOT is set to inetpub\wwwroot

System

System path to c:\php
Environmental Variable PHPRC to c:\php

IIS

Isapi extension is setup for PHP5ISAPI.DLL


Any Suggestions?

Share this post


Link to post
Share on other sites
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!

Share this post


Link to post
Share on other sites
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?

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
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?

Share this post


Link to post
Share on other sites

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.