Jump to content

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?
Link to comment
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!
Link to comment
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.
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

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.