PDA

View Full Version : cannot connect to mysql with php script?



shams
28th April 2006, 12:53 PM
hi,
when i was using fc4 wrking fine with php-mysql but just installed the fc5, php and webserver as well mysql is working fine but can't connect with php script to mysql, this is the test script:
<?php
$link = mysql_connect('localhost', 'root', '');
if (!$link) {
die('Could not connect: ' . mysql_error());
}
echo 'Connected successfully';
mysql_close($link);
?>
there is no error just blanck page, i configured the php.ini for mysql as fc4 but still can't connect, any help please?

LLS
28th April 2006, 02:21 PM
Just ran your script as written and it connects properly "Connected successfully". Fc5 lamp
By the way, love your how-tos especially the grub boot floppy.

pete_1967
28th April 2006, 02:54 PM
That's what you are supposed to receive if you run that script alone. It only makes a connection to database and only returns error message on page if it can't connect.

You need to perform some queries, process results and print them on screen for you to see more than blank page after executing your origianl script.

mbokil
29th April 2006, 02:02 AM
To get mysql to connect via PHP I had to 'yum install php-mysql' in FC5. Now it works.