garyed Posted September 23, 2010 Share Posted September 23, 2010 I'm having a problem either connecting to the databse or to mysql completely. I'm running pclinux zenmini on my laptop with Apache/Php/Mysql installed. I can access mysql databases through the terminal but my php file that accesses it doesn't work through localhost on my web browser. I can run other php programs through the browser on localhost so I know php is working right. I have the same mysql database on my Desktop running Ubuntu & everything works fine through the browser using the same php file. I tried to intentionally put in the wrong password on the desktop to see if I get an error & it says "Could not connect" When I do the same thing on my laptop I don't get any error, just a blank screen. It acts like apache & mysql aren't communicating. Here's how I'm accessing mysql: $link = mysql_connect ("localhost", "root", "password") or die ("Could not connect"); print ("Connected to mysql successfully"); Is there some setup that I could be lacking ? any ideas welcome Quote Link to comment https://forums.phpfreaks.com/topic/214210-cant-connect-i-think/ Share on other sites More sharing options...
mikosiko Posted September 23, 2010 Share Posted September 23, 2010 did you run phpinfo() to check that Mysql is enabled? look if you have extension=php_mysql.dll enabled in your php.ini and also be sure that extension exist in your extension_dir. and finally add this lines to you php script to see what error it is sending error_reporting(E_ALL); ini_set("display_errors", 1); Quote Link to comment https://forums.phpfreaks.com/topic/214210-cant-connect-i-think/#findComment-1114652 Share on other sites More sharing options...
garyed Posted September 23, 2010 Author Share Posted September 23, 2010 1 - phpinfo() returns PHP version 5.3.1 2 - Adding the error line to the script I get this: Fatal error: Call to undefined function mysql_connect() in /var/www/gary/gary_web/php_scripts/mysql_retrieve_from_dbase2.php on line 15 3 -All I could find in php.ini was: extension_dir = "/usr/lib/php/extensions" I checked my whole drive & there's no "php_mysql.dll file on it either. I thought .dll files were for windows only. By the way thanks again for the help from the other forum. Everything is working great now on my desktop. I know the code is right because it works on my desktop so I'm hoping its just a setup problem. Quote Link to comment https://forums.phpfreaks.com/topic/214210-cant-connect-i-think/#findComment-1114667 Share on other sites More sharing options...
garyed Posted September 24, 2010 Author Share Posted September 24, 2010 I got it! It ended up that I didn't have the php-mysql package loaded in PCLinux /Zenmini I found it in synaptic & everything is fine. Thanks for the ideas Quote Link to comment https://forums.phpfreaks.com/topic/214210-cant-connect-i-think/#findComment-1114840 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.