Page 1 of 1

Cant Connect PHP to MYSQL on new installation

Posted: Thu Jan 26, 2012 2:15 pm
by zocker
Greetings, thanks for reading and thanks for the Forum!!! I have just spent one week downloading programs and configuring APACHE, PHP, MYSQL (and G only knows how many patches updates and Windows twiddly bits) in order to install them and then getting lost in a maze of software!
It doesn't all quite work yet. I have created a MYSQL databse and in it..a Table with 3 fields. I am especially proud that I found how to do an AutoNumber on its key field.....check the nearly invisible box that says AutoIncrement....

I have got PHP running as well, I made a PHP page that delivered "HELLO WORLD" as a web page after two days before I learned it has to be in a specified MySQL folder.

Anyway, after another educational week, I still cannot connect PHP to MYSQL, I have searched the internet for all like problems and have followed lots of instructions and advice and have modified PATHS and ini files and all sorts but..still no connection! I would be so glad for some help from an experienced solver of nightmares.

Thanks again

I attach a pic of the PHP config info....the php.ini file IS in the 'Windows' folder neverthless will not register.

Code: Select all

<?php 
$link = mysql_connect('localhost:3306', 'root','pass'); 
if (!$link) { 
     die('Could not connect: ' . mysql_error()); 
} 

?>

This error is raised:

Fatal error: Call to undefined function mysql_connect() in C:\Program Files\Apache Software Foundation\Apache2.2\htdocs\testconnect.php on line 2


And this jpg describes the state of PHP.
Image


Thanks again,
Zocker

Re: Cant Connect PHP to MYSQL on new installation

Posted: Thu Jan 26, 2012 2:20 pm
by Celauran
Looks like the build didn't include MySQL support. You'll need to either recompile or download a new binary package.

Re: Cant Connect PHP to MYSQL on new installation

Posted: Thu Jan 26, 2012 6:01 pm
by Hitman47
Configuring and installing PHP and MySQL to apache can get confusing and troublesome. You can find many guides on the internet with instructions on how to do so, and even then you are bound to run into problems.

What I can and will recommend is using a precompiled package. I personally like to use lammp for linux. They also have a compiled package for windows! Check it out! It's fairly easy to get going and it will make it easier to make updates. Note that you may not always have the newest packages but for what you require it for you can probably get away with that!

Hope that helps!

Re: Cant Connect PHP to MYSQL on new installation

Posted: Fri Jan 27, 2012 8:57 am
by zocker
Many thanks for your replies! I will try another install package!

Zocker