[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()"
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.
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.
*********************************
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.
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.
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
Quote:
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.)
Re: Problem in connecting to MySQL DB thru PHP Script
Thanks Much penagate for the useful info.