Results 1 to 7 of 7

Thread: [RESOLVED] Problem in connecting to MySQL DB thru PHP Script

  1. #1

    Thread Starter
    Member
    Join Date
    Sep 2007
    Posts
    58

    Resolved [RESOLVED] Problem in connecting to MySQL DB thru PHP Script

    I have Installed PHP 5.2.6 and trying to connect to MySQL . I have edited php.ini file

    And i have copied php_mysql.dll and php_mysqli.dll to C:
    C:\WINDOWS\system32

    php.ini file is present in C:\WINDOWS

    The below lines were uncommented.
    extension=msql.dll
    extension=php_mysql.dll
    extension=msql.so

    but still i face a problem saying "Fatal error: Call to undefined function: mysql_connect()"
    Last edited by NehaRao; Oct 31st, 2008 at 04:18 AM.

  2. #2
    I'm about to be a PowerPoster!
    Join Date
    Jan 2005
    Location
    Everywhere
    Posts
    13,647

    Re: Problem in connecting to MySQL DB thru PHP Script

    Ensure the extension_dir setting points to the 'ext' directory within the PHP installation directory. You do not need to place extension DLLs anywhere else and in fact I recommend that you don't.

  3. #3

    Thread Starter
    Member
    Join Date
    Sep 2007
    Posts
    58

    Re: Problem in connecting to MySQL DB thru PHP Script

    Hi .. Thanks for the reply

    Yes i agree with that , Without doing all that , i am able to connect now . I have checked my configurations settings thoroughly. and Yes now i am able to connect to My SQL .

    btw , this is the article which helped me in establishing the connection
    http://cyleft.wordpress.com/2008/05/...-32bit-or-x64/

    But now i face a different problem now
    *********************************
    Unable to connect to MySQL.Host 'ipaddress' is not allowed to connect to this MySQL server.
    *********************************
    Last edited by NehaRao; Nov 1st, 2008 at 02:24 AM.

  4. #4
    I'm about to be a PowerPoster!
    Join Date
    Jan 2005
    Location
    Everywhere
    Posts
    13,647

    Re: Problem in connecting to MySQL DB thru PHP Script

    If the MySQL server is on a remote machine you will need to ensure that it is configured to accept remote connections.

    See this article for how to do so (assuming you have access to the MySQL server).
    http://www.cyberciti.biz/tips/how-do...se-server.html

    If the MySQL server is running on Windows, substitute [installation path]\my.ini for /etc/my.cnf.

  5. #5

    Thread Starter
    Member
    Join Date
    Sep 2007
    Posts
    58

    Re: Problem in connecting to MySQL DB thru PHP Script

    Hi .
    I am trying to access the mysql DB which is on my local machine thru PHP script, and in PHP Script i have given host as my system's IP Address.

    It worked just now when i have passed the value as localhost instead of my machines ip address for host variable.

    Sorry that i didnt understand what i need to do when u have mentioned that Substitute {installationpath}/my.ini for etc/my.cnf

    I could locate my.ini file ..

    Now i am trying to understand why its not working when i gave my system's ip address.

  6. #6
    I'm about to be a PowerPoster!
    Join Date
    Jan 2005
    Location
    Everywhere
    Posts
    13,647

    Re: Problem in connecting to MySQL DB thru PHP Script

    If you use your LAN IP address to connect then the connection is considered remote because your client address is also your LAN IP instead of the loopback address (127.0.0.1). Use 'localhost' or 127.0.0.1 to connect to the server if it is installed locally.

    Remote connections can be enabled on a per-user basis by using the SQL GRANT command to assign permissions to a username and host address (for example, 'root@localhost' is set up by default). You can allow an account to connect from any host address by using the value '%' instead of an address (e.g. 'neharao@%').

    Allowing remote root connections ('root@%') is inadvisable for security reasons.


    Reference:
    http://dev.mysql.com/doc/refman/5.0/...ss-denied.html
    If the following error occurs when you try to connect from a host other than the one on which the MySQL server is running, it means that there is no row in the user table with a Host value that matches the client host:

    Host ... is not allowed to connect to this MySQL server

    You can fix this by setting up an account for the combination of client hostname and username that you are using when trying to connect.

    If you do not know the IP number or hostname of the machine from which you are connecting, you should put a row with '%' as the Host column value in the user table. After trying to connect from the client machine, use a SELECT USER() query to see how you really did connect. (Then change the '%' in the user table row to the actual hostname that shows up in the log. Otherwise, your system is left insecure because it allows connections from any host for the given username.)

  7. #7

    Thread Starter
    Member
    Join Date
    Sep 2007
    Posts
    58

    Re: Problem in connecting to MySQL DB thru PHP Script

    Thanks Much penagate for the useful info.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width