Jump to content

Recommended Posts

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

 

 

Link to comment
https://forums.phpfreaks.com/topic/214210-cant-connect-i-think/
Share on other sites

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);

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.

 

 

 

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.