PDA

View Full Version : White screen - pb with mysql_connect


totobeloeil
04-06-2006, 10:21 AM
Hello,
I can't connect to mySQL because something don't work :
I've got the 'echo' I put just before CONNECT.PHP calls mysql_connect, but I the 'echo' that is just after the call doesn't appear :

if (!defined('PHPDIG_DB_NAME')) {
define('PHPDIG_DB_PREFIX','');
define('PHPDIG_DB_HOST','localhost');
define('PHPDIG_DB_USER','root');
define('PHPDIG_DB_PASS','admin');
define('PHPDIG_DB_NAME','phpdig');
}
echo 'connect.php - avant appel de @mysql_connect<br>';
$id_connect = @mysql_connect(PHPDIG_DB_HOST,PHPDIG_DB_USER,PHPDIG_DB_PASS);
if (!$id_connect) {
echo ('out 1 connect.php<br>');
die("connect.php - Unable to connect to database : Check the connection script.\n");
}
echo 'connect.php - apres appel de @mysql_connect<br>';

The phpdig database and tables have been created in command-line mode, so mySQL is working.
What's wrong ?

totobeloeil
04-07-2006, 10:48 AM
This was obvious :
MySQL is an extension of PHP.
So, another modification of php.ini is required.
See the official PHP documentation for further explanation :

http://www.php.net/manual/en/ref.mysql.php (http://www.php.net/manual/en/ref.mysql.php)

loanskey
04-08-2006, 09:39 PM
what you want us to look specifically over here ...


http://www.php.net/manual/en/ref.mysql.php


:deal:

totobeloeil
04-09-2006, 01:49 AM
Hi,

You can get more complete information here :
http://www.php.net/manual/en/install.windows.extensions.php

For the installation of MySQL, I did the following modifications in the PHP.INI file :
extension_dir = "./ext/"
extension=php_mysqli.dll
extension=php_mysql.dll

Note that the lines are uncommented (i.e. without the leading ';').

Then, I created a folder 'ext' in the PHP directory, and put there the files 'php_mysqli.dll' and 'php_mysql.dll'.

I also copied the 'libmysql.dll' file into the folder C:\WINNT\System32 (because windows is there, could be C:\WINDOWS or anything else).

I found these files into the manual distribution of PHP.

The path to the PHP directory was specified during the installation of PHP, by adding it to the PATH environment variable (configuration panel / system / advanced).

Then, I restarted the machine, but I think you could jut restart the web server.

Then the install.php worked.

I hope this will be helpfull.