hello to everyone here ... please i need your help . i have some trouble with php and my SGBDs ... i have installed php mysql and apache separately . but when i launch a php program with mysql_connect it send a 500 internal error without response . i have changed mysql to postgresql but it is the same problems . i have also remove the comma before some line in php.ini but it's the same result ... there is a simple connection to the database code examples `
<?php
$link = pg_connect('localhost', 'USERNAME', 'PASSWORD');
if (!$link) {`
die('Could not connect: ' . mysql_error());
}
echo 'Connected successfully';
pg_close($link);
` and there is the result the result of the code with 500 error and there is my php.ini file image of my php.ini thanks you
Have you restart apache ?
Set display_errors
directive to On
in your php.ini
Create info.php
in your document root, put <? phpinfo(); ?>
into it. Open info.php
from your browser, try to find word "pdo_pgsql" / "pdo_mysql". Has it appear correctly ?
Dig into your apache access_log
and error_log
files to get further clue about your error.
According to http://php.net/manual/en/function.pg-connect.php, you need to do
pg_connect("host=localhost dbname=mary user=USERNAME password=PASSWORD");
So the format is not correct and dbname is missing from your code.