I seem to have a problem getting mysql 4.1.5 to work with php 5.0.3.

I have installed Apache 2.0.x on my Windows XP Home SP1 PC.
I have installed MySQL 4.1.5
Also I have installed PHP 5.0.3 as a Module and seems to work fine with Apache

<?php
phpinfo();
?>

I have created a DB called world and imported the .sql file into MySQL (From MySQL website if anyone wants the World DB to test)

this is the code I used to test......

<?php 

/* Connect to a MySQL server */ 
$link = mysqli_connect( 
            'localhost',  /* The host to connect to */ 
            'user',       /* The user to connect as */ 
            'password',   /* The password to use */ 
            'world');     /* The default database to query */ 

if (!$link) { 
   printf("Can't connect to MySQL Server. Errorcode: %s\n", mysqli_connect_error()); 
   exit; 
} 

/* Send a query to the server */ 
if ($result = mysqli_query($link, 'SELECT Name, Population FROM City ORDER BY Population DESC LIMIT 5')) { 

print("Very large cities are:\n"); 

/* Fetch the results of the query */ 
while( $row = mysqli_fetch_assoc($result) ){ 
    printf("%s (%s)\n", $row['Name'], $row['Population']); 
} 

/* Destroy the result set and free the memory used for it */ 
mysqli_free_result($result); 
} 

/* Close the connection */ 
mysqli_close($link); 
?> 

But comes up with a fatal error....

Fatal error: Class 'mysqli' not found in C:.....

I have added the php_mysql.dll to Windows\System32 but I could not find a 'libmysqli.dll' only libmysql.dll'

I had an earlier version of php 5.0.2 that did include the libmysqli.dll.

I have no idea what I can do to get mysql to work with php5. It was I remeber so easy to set up.

Any help would be great.

Many thanks for you time.

Sten

    I'm not too familiar with MySQLi, but have you edited your PHP.ini file accordingly? By that I mean have you uncommented the php_mysql.dll line? Also, is your extension_dir path pointed at Windows\System32?

    As far as libmysqli.dll, I would google it.

    Just a few thoughts.

      Thanks for your reply.

      I have set up my PHP.ini file correctly along with my extension path. I have also googled the 'libmysql.dll' and found that is is available in php 5.0.2

      Not sure where to go now. I have checked and double checked all documentation at php.net and mysql.com but still no help as to my issue.

      Thanks anyway.

        I did a search on my machine, and found that libmysql.dll is both in the MySQL folder and the php-5.0.3 binary folder. Are you just using the installer?

          Hi Thora_fan,

          No it was a manual install, dont like the installer as it only installs the CGI version which isnt what I want. I know about the libmysql.dll in both PHP and MySQL, but its the libmysqli.dll that I need. or that I need to work at least.

          Thanks again,

            Originally posted by Thora_Fan
            I'm not too familiar with MySQLi, but have you edited your PHP.ini file accordingly? By that I mean have you uncommented the php_mysql.dll line? Also, is your extension_dir path pointed at Windows\System32?

            As far as libmysqli.dll, I would google it.

            Just a few thoughts.

            I feel like a right idiot.

            I thought I would double check my setup inparticular my extension dir in the php.ini

            After a few changes it works

            Thanks Thora_Fan

            Sten

              No problem. Those are mistakes that we all have made at some point and will continue to make. That's why we are programmers.

                Write a Reply...