Jump to content

php mysql cant communicate


fje

Recommended Posts

i seem to have a problem with mysql.

i have installed mysql and php... i can start him up and i can see that he is up and running... but somehow i

cant let php talk to mysql.

 

i have already installed the odbc drivers for mysql and i used a standard script for connecting to mysql

the version of mysql is 5.1.11 and php is also 5.0

i cant realy give you anny error messages ore somthing like that it just won't connect.

 

i think php doesnt allow acces to mysql can sombuddy tell my if this part of php.ini is correct?

 

 

extension=php_bz2.dll

extension=php_curl.dll

;extension=php_dba.dll

extension=php_dbase.dll

;extension=php_exif.dll

;extension=php_fdf.dll

extension=php_gd2.dll

;extension=php_gettext.dll

;extension=php_gmp.dll

;extension=php_ifx.dll

;extension=php_imap.dll

;extension=php_interbase.dll

;extension=php_ldap.dll

;extension=php_mbstring.dll

;extension=php_mcrypt.dll

;extension=php_mhash.dll

;extension=php_mime_magic.dll

;extension=php_ming.dll

;extension=php_msql.dll

;extension=php_mssql.dll

extension=php_mysql.dll

extension=php_mysqli.dll

;extension=php_oci8.dll

;extension=php_openssl.dll

;extension=php_pdo.dll

;extension=php_pdo_firebird.dll

;extension=php_pdo_mssql.dll

extension=php_pdo_mysql.dll

;extension=php_pdo_oci.dll

;extension=php_pdo_oci8.dll

;extension=php_pdo_odbc.dll

;extension=php_pdo_pgsql.dll

;extension=php_pdo_sqlite.dll

;extension=php_pgsql.dll

;extension=php_pspell.dll

;extension=php_shmop.dll

;extension=php_snmp.dll

;extension=php_soap.dll

;extension=php_sockets.dll

;extension=php_sqlite.dll

;extension=php_sybase_ct.dll

;extension=php_tidy.dll

;extension=php_xmlrpc.dll

;extension=php_xsl.dll

extension=php_zip.dll

 

 

thanks for the help....

 

greating fje

 

 

Link to comment
Share on other sites

the script i am using to connect to the mysql:

 

<?

 

 

mysql_connect(localhost,$user,$password);  ( i did fill them in, in the script i am using..)

 

 

 

 

 

?>

as far as i know this is a standard script for making a connection to my sql...

 

 

and the server logs dont show annything...

what i do know is mysql is running... and php is installed good becouse it runs php scripts but the script cant connect to mysql

 

Link to comment
Share on other sites

mysql_connect() expects string parameters, so localhost (with no quotes) generates a warning or notice error. Your code is also using short open tags <? which might be preventing any php code from executing. Your code also has no error checking to see if the mysql_connect() function call worked. The following code is from the php manual for the mysql_connect() function, adapted to use your two variables. Use it to connect -

 

<?php
$link = mysql_connect('localhost', $user,$password);
if (!$link) {
    die('Could not connect: ' . mysql_error());
}
echo 'Connected successfully';
?> 

Link to comment
Share on other sites

fje first enable a setting called display_errors within the the php.ini and ensure error_reporting is set to at least E_ALL.

 

Save your php.ini and restart your server. Re run your script for connecting to mysql. If there is any problems PHP should now be displaying the errors within the browser. Post all error messages you get here in full. I don't think PHP has enabled the mysql library (even though you have uncommented it within the php.ini). The mysql extension does rely on an external library called libmysql.dll in order to function to correctly.

Link to comment
Share on other sites

when i use that script i get this error message:

 

 

Fatal error: Call to undefined function mysql_connect() in C:\inetpub\ftproot cesar\websitehosting\test5\index.php on line 3

 

that is the error i keep on getting when i want to make a connection to mysql database.

Link to comment
Share on other sites

when i use that script i get this error message:

 

 

Fatal error: Call to undefined function mysql_connect() in C:\inetpub\ftproot cesar\websitehosting\test5\index.php on line 3

 

that is the error i keep on getting when i want to make a connection to mysql database.

And you've already read the sticky on this topic?

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.