Unable to connect mysql via php

Need help installing PHP, configuring a script, or configuring a server? Then come on in and post your questions! We'll try to help the best we can!

Moderator: General Moderators

Post Reply
Abha
Forum Newbie
Posts: 3
Joined: Wed Mar 25, 2009 11:42 am

Unable to connect mysql via php

Post by Abha »

Hello All!

I am new to mysql and php.I tried to connect mysql with php via the following code.But, all i get is an error message HTTP 500 internal server error.
<?php
$conn = mysql_connect("localhost","root","abha") or die(mysql_error());
mysql_select_db("project",$conn);
?>

I am using:-
Php 5.2.8
Apache 2.2.11
Mysql 5.0.67
Operating System - Vista Home edition
Please solve my problem.
Thanks in advance.
User avatar
califdon
Jack of Zircons
Posts: 4484
Joined: Thu Nov 09, 2006 8:30 pm
Location: California, USA

Re: Unable to connect mysql via php

Post by califdon »

Usually that means that one of your configuration files is incorrect, either it can't be found (wrong directory) or it doesn't contain correct information needed by your system to work, such as locations of other files, etc. It's almost impossible to tell you what's wrong. How did you install this? Was it a WAMP-like package of Apache/MySQL/PHP or did you install them individually? Have you made any changes to your httpd.conf, PHP.ini or other configuration files?
Abha
Forum Newbie
Posts: 3
Joined: Wed Mar 25, 2009 11:42 am

Re: Unable to connect mysql via php

Post by Abha »

I installed them individually.It was available on downloads.com.Yes ,I did make some changes as directed by them.

Abha
Post Reply