Jump to content

Recommended Posts

 

php 5.0 and MYSQL 5.0 connection problem ?

 

There is a connection problem between php 5.12 and MYSQL 5.0. I had performed these steps,

1> Installation of Apache 2.2.8 MYSQL 5.0 & php 5.0 done successfully.

2>downloaded the php_5.2.0_mysqli_5.0.27-win32 for connection talking. Copied in to following directories "D:\Program Files\PHP\ext"

"C:\WINDOWS\system"

"C:\WINDOWS\"

3> Also added these lines to php.ini

extension_dir = "D:/Program Files/PHP/ext/"

extension=php_mysqli.dll

4> Using phpinfo(), it shows the Mysqli section.

But while connecting through the php programs it takes too long to respond and wont work.

    If anyone had tried the OReilly "Learning.PHP.and.MySQL" ,2nd.Edition.Aug.2007 please let me know.

                                                                                                        Thank You.

Link to comment
https://forums.phpfreaks.com/topic/93731-php-50-and-mysql-50-connection-problem/
Share on other sites

2>downloaded the php_5.2.0_mysqli_5.0.27-win32 for connection talking. Copied in to following directories "D:\Program Files\PHP\ext"

"C:\WINDOWS\system"

"C:\WINDOWS\"

No need to copy multiple instances of the same file to different location's in the file system. I highly suggest you keep all files that come with PHP in your PHP Installation folder and adding PHP to the PATH Environment Variable.

 

What do you mean by the following:

But while connecting through the php programs it takes too long to respond and wont work.

Do you get any errors, what shown on screen. Are you connecting to a remote database?

 

Might want to post some code too.

I've  modified the PATH variable with following -

;D:\Program Files\PHP;%SystemRoot%\system32;%SystemRoot%;%SystemRoot%\System32\Wbem;C:\Program Files\MySQL\MySQL Server 5.0\bin;C:\Program Files\Microsoft SQL Server\80\Tools\BINN

The apache web server is already running I've started the MySQL Administrator tool and logged as root and it's  password. Created a dummy user ABC and it's password "ABC"

 

The code for the db_login.php

 

<?php

$db_host="localhost";
$db_database="om";
$db_username="ABC";
$db_password="ABC";
?>

the calling file db_test.php

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">

<head>
  <title></title>
</head>

<body>
<?php
// Include our login information
include('db_login.php');
// Connect
$connection = mysql_connect( $db_host, $db_username, $db_password );
if (!$connection){
die ("Could not connect to the database: <br />". mysql_error( ));
}
// Select the database
$db_select=mysql_select_db($db_database);
if (!$db_select){
die ("Could not select the database: <br />". mysql_error( ));
}
//188 | Chapter 9: Getting PHP to Talk to MySQL
// Assign the query
$query = "SELECT * FROM books NATURAL JOIN authors";
// Execute the query
$result = mysql_query( $query );
if (!$result){
die ("Could not query the database: <br />". mysql_error( ));
}
// Fetch and display the results
while ($result_row = mysql_fetch_row(($result)))
{
echo 'Title: '.$result_row[1] . '<br />';
echo 'Author: '.$result_row[4] . '<br /> ';
echo 'Pages: '.$result_row[2] . '<br /><br />';
}

mysql_close($connection);
?>

</body>
</html>

 

It shows no syntex errors wile debugging. Taking the output in MIcrosoft IE7  shows following

"  The website cannot display the page

HTTP 500 

  Most likely causes:

The website is under maintenance.

The website has a programming error.

 

  What you can try:

    Refresh the page.

 

    Go back to the previous page.

 

    More information

 

This error (HTTP 500 Internal Server Error) means that the website you are visiting had a server problem which prevented the webpage from displaying. " 

 

On the other hand in Firefox only white background appares.

                                                        Thank you.

I notice you are using the standard mysql PHP functions (mysql_*) but you have enabled the mysql improved extension. If you want to use the standard functions you'll need to enable the standard mysql extension (php_mysql.dll not php_mysqli.dll).

 

php_mysql.dll and php_mysqli.dll both have separate function libraries.

 

I'm very much confused whether ,I should change the name php_mysqli.dll to php_mysql.dll in all copies

and add in php.int

 

extension=php_mysqli.dll replaced by extension=php_mysql.dll

 

When I change it to extension=php_mysql.dll the  mysqli section previously shown in the php information table is vanish completely.

 

And which one is the better using standard functions of the advanced to be used in the beginner stage

You don't rename file php_mysqli.dll to php_mysql.dll. You should already have a file called php_mysql.dll located in PHP's ext/ folder (D:\Program Files\PHP\ext).

 

If you don't then I recommend you go to php.net and download the (PHP 5.2.5 zip package. extract the contents of zip to D:\Program Files\PHP overwriting existing files/folders. You shlould now have php_mysql.dll available in the ext/ folder. Add/uncomment the following line:

extension=php_mysql.dll

within the php.ini. Make sure you save your php.ini and restart Apache for the changes to take affect.

That was small, but tricky process.

 

First ,I had  stopped the Apache server ,then extract the contents of the php-5.2.5-Win32.zip file overwriting all of them on location where php is installed. Registry files successful entering the data after double clicking them.

 

Then after restarting the Apache server it was very very slow.

 

finally i reinstall Apache server again. Now it works fine as expected.

 

                              Thank You.

 

Now there is something i had to tell you. I had removed all the installations of Apache , php , MySQL.

I installed in the following order ,

1> Apache

2> php

3> MySQL

 

Then overwriting the contents of php-5.2.5-Win32 to php installed location. I had to only add the

extension=phpmysql.dll

 

Now it works best , thanks to you.

 

Now my applications are installed on

Apache on "D:\Program Files\Apache Software Foundation\Apache2.2 " ,

php on " D:\Program Files\PHP " ,

Rapid PHP 2007 editor is  installed in the " D:\Program Files\Rapid PHP 2007 "

and my MySQL on the " C:\Program Files\MySQL "

 

Now I've another confusion about the PEAR installation. Please tell me in simple steps.

The file DB.php which is must use after installation.

 

Is is possible for including the DB.php file in the root folder of apache after installation?

or it take's it automatically without specifying it ?

 

          Thank you.

 

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.