Page crashes at mysql_connect.

Problems with the Windows version of XAMPP, questions, comments, and anything related.

Page crashes at mysql_connect.

Postby Bone_less1213 » 18. November 2007 06:50

Basically I'm running Xampp it says I have the driver 3.51 installed now, but for some reason this code below only displays test once. While if I get rid of everything else but the echo statements it will display testtest.

So to be clear, there are no errors displayed on die, and the program just crashes because of the fact that I call mysql_connect is there something I need to do to xampp before I can get mysql to connect?

Code: Select all
<HTML><Head><title></title></head><body>
<?php
echo "test";
$con = mysql_connect("localhost","admin","password");
if (!$con)
  {
  die('Could not connect: ' . mysql_error());
  }
  echo "test";
?>
</body></HTML>
Bone_less1213
 
Posts: 3
Joined: 18. November 2007 06:39

Postby kmnair » 18. November 2007 07:18

Did you set up Xampp properly?

Is MySql running?

If you are trying to run a website which uses a MySql db, is the database setup/created correctly?

The error message shows a db connect error.

HTH

kmnair
kmnair
 
Posts: 4
Joined: 18. November 2007 05:13

Postby Bone_less1213 » 19. November 2007 05:48

Yes mysql is running

I think MySQL is setup correctly because it gave me an error before but I installed drivers and it seems to give no errors.

It shows no message, only a blank screen. other than it echos one test, it does not echo the second test unless I remove the mysql_connect code.

I assume that if I cannot connect to mysql that worrying about databases is not relevant, but I am new to this so I don't know.

and as a final note, this is just a simple program running from inside htdocs, all the code you see is all the code there is for this test.

Could giving an illegal name for a host crash it? Maybe the tutorial I read was too vague and I need a little more instruction for MySQLAdmin

thanks for any help.
Bone_less1213
 
Posts: 3
Joined: 18. November 2007 06:39

Postby Izzy » 19. November 2007 06:16

OK, lets start this from the beginning.

You installed XAMPP, the install instructions you followed without any problems?

After installation and before running any of the XAMPP components you checked that all ports that XAMPP requires exclusively are free by running xampp\xampp-portcheck.exe? - no Skype, IIS or any other instances of Apache, MySQL or PHP using the ports.

You started Apache and MySQL using, at a guess, the XAMPP Control Panel and had no errors there?

You then went to:
http://localhost
in your browser and was presented with the XAMPP Welcome page?

You tried all the demos in the left hand menu frame and you had no errors with any of them including the database demos.

You checked the Status of your XAMPP installation?

Next you opened phpMyAdmin from the left hand menu frame and created a database with a user and a user password with access privileges for that database and had no errors?

I don't know what drivers 3.51 you talk about - ODBC?

Reference:
http://community.apachefriends.org/f/viewtopic.php?t=27275

MySQLAdmin you mention is no longer used, it is deprecated and does not create databases anyway - use phpMyAdmin only to interface with MySQL as it is a very good GUI.

Now lets move on from here if all the above are error free and you have no issues - if you do then post back and we can take a look at them if you provide as much detail as possible.


===========================================
1. The new DeskTopXampp Launch Control for XAMPP / XAMPPlite
Posted by Ridgewood available from Ridgewood'sDTX web site

2. Build Rich AJAX Applications - Faster
TIBCO General Interface Pro Edition but FREE and Open Source
Fully working with NO donations required to get a user/password
===========================================
Izzy
 
Posts: 3344
Joined: 25. April 2006 17:06

Postby Bone_less1213 » 20. November 2007 04:53

Thanks, I went through your steps(Didn't know there were that many to troubleshoot it, thanks) and I think I atleast found some info that might help someone solve this problem. Because there was a trouble shoot guide that told me how but I couldn't find the file it said to find(it gave a vague description of the name of the file..)

When i tried to load phpmyadmin from the left hand side it gave an error and a link to an FAQ which displayed the exact same error message it reads:

1.20 I receive the error "cannot load MySQL extension, please check PHP Configuration".

To connect to a MySQL server, PHP needs a set of MySQL functions called "MySQL extension". This extension may be part of the PHP distribution (compiled-in), otherwise it needs to be loaded dynamically. Its name is probably mysql.so or php_mysql.dll. phpMyAdmin tried to load the extension but failed.

Usually, the problem is solved by installing a software package called "PHP-MySQL" or something similar.


So my question is, what does he mean by I need to install a package named phpmysql or something? not a very direct answer. I was wondering if someone could help me by telling me what that file is above that it mentions needs installing.

thank you
Bone_less1213
 
Posts: 3
Joined: 18. November 2007 06:39


Return to XAMPP for Windows

Who is online

Users browsing this forum: No registered users and 87 guests