Jump to content


Photo

PHP5 and MYSQL 5 Installation Problem


  • Please log in to reply
5 replies to this topic

#1 roneill18901

roneill18901
  • New Members
  • Pip
  • Newbie
  • 3 posts

Posted 19 September 2006 - 08:38 PM

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?


#2 wildteen88

wildteen88
  • Staff Alumni
  • Advanced Member
  • 10,482 posts
  • LocationUK, Bournemouth

Posted 20 September 2006 - 09:23 AM

YOu need to edit the php.ini to enable the mysql extension (php_mysql.dll). Have a read of this FAQ 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!

#3 roneill18901

roneill18901
  • New Members
  • Pip
  • Newbie
  • 3 posts

Posted 20 September 2006 - 11:46 AM

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?

#4 wildteen88

wildteen88
  • Staff Alumni
  • Advanced Member
  • 10,482 posts
  • LocationUK, Bournemouth

Posted 20 September 2006 - 03:13 PM

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.

#5 roneill18901

roneill18901
  • New Members
  • Pip
  • Newbie
  • 3 posts

Posted 20 September 2006 - 03:15 PM

Done.  Numerous time.

#6 wildteen88

wildteen88
  • Staff Alumni
  • Advanced Member
  • 10,482 posts
  • LocationUK, Bournemouth

Posted 20 September 2006 - 03:34 PM

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?




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users