fje Posted January 9, 2008 Share Posted January 9, 2008 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 Quote Link to comment https://forums.phpfreaks.com/topic/85261-php-mysql-cant-communicate/ Share on other sites More sharing options...
PFMaBiSmAd Posted January 9, 2008 Share Posted January 9, 2008 Start by checking your web server log for errors after you have executed a script that should connect. Also post your code so that we can see what it is you are trying to do. Quote Link to comment https://forums.phpfreaks.com/topic/85261-php-mysql-cant-communicate/#findComment-434960 Share on other sites More sharing options...
fje Posted January 10, 2008 Author Share Posted January 10, 2008 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 Quote Link to comment https://forums.phpfreaks.com/topic/85261-php-mysql-cant-communicate/#findComment-435518 Share on other sites More sharing options...
PFMaBiSmAd Posted January 10, 2008 Share Posted January 10, 2008 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'; ?> Quote Link to comment https://forums.phpfreaks.com/topic/85261-php-mysql-cant-communicate/#findComment-435654 Share on other sites More sharing options...
wildteen88 Posted January 10, 2008 Share Posted January 10, 2008 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. Quote Link to comment https://forums.phpfreaks.com/topic/85261-php-mysql-cant-communicate/#findComment-435806 Share on other sites More sharing options...
fje Posted January 11, 2008 Author Share Posted January 11, 2008 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. Quote Link to comment https://forums.phpfreaks.com/topic/85261-php-mysql-cant-communicate/#findComment-436369 Share on other sites More sharing options...
fenway Posted January 11, 2008 Share Posted January 11, 2008 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? Quote Link to comment https://forums.phpfreaks.com/topic/85261-php-mysql-cant-communicate/#findComment-436640 Share on other sites More sharing options...
wildteen88 Posted January 11, 2008 Share Posted January 11, 2008 My earlier guess was correct. Please read this FAQ for enabling the mysql_extension. EDIT: Fenway beat me Quote Link to comment https://forums.phpfreaks.com/topic/85261-php-mysql-cant-communicate/#findComment-436647 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.