MySQL for PHP

Hi, my friend is trying to setup MySQL to work with PHP. He's using WordPress and he already has installed PHP successfully but WordPress gives the following:

Error establishing a database connection

This either means that the username and password information in your wp-config.php file is incorrect or we can't contact the database server at localhost. This could mean your host's database server is down.

He was reviewing this:

http://developers.sun.com/webserver/reference/techart/php2.html

he did things about compiling and something else... but no results. We don't know what to do.

How should he proceed?

thanks in advance

ra鷏

[692 byte] By [Aeon_Lancera] at [2007-11-27 7:52:16]
# 1
f you are running WebServer 7.0, you can try php version provided by Sun. http://www.sun.com/download/products.xml?id=45c26bc9
Basantka at 2007-7-12 19:33:30 > top of Java-index,Web & Directory Servers,Web Servers...
# 2
Yes, it's what we've done and PHP seems to work alright but not MySQL
Aeon_Lancera at 2007-7-12 19:33:30 > top of Java-index,Web & Directory Servers,Web Servers...
# 3

I assume your mysql installation is working alright, i.e. you can connect to it with mysql command using the same settings provided for your PHP app, right? If so, what are the errors you are getting,

Also, what are you exactly are you trying to accomplish?

Finally, when working with PHP the mysql connectivity is provided completely by PHP and your app. The web server has no contact with MySQL.

nseguraa at 2007-7-12 19:33:30 > top of Java-index,Web & Directory Servers,Web Servers...
# 4

The thing is: my friend has installed Sun Java System, then the PHP add on, this one:

http://www.sun.com/download/products.xml?id=45c26bc9

And the last MySQL version. He is trying to run WordPress but PHP seems not to connect with MySQL, this is the address:

http://200.72.40.204/revista/

We think it's something related to Sun Java System or the php add-on, because when using wordpress with Apache, it works fine, it doesn't throw that error.

I mean, this happen only when using Sun Java System.

Aeon_Lancera at 2007-7-12 19:33:30 > top of Java-index,Web & Directory Servers,Web Servers...
# 5
Hi Please download the PHP Add-on binaries that we ship. This bundle has MySQL support built into it. In your case, it is most likely that this mysql library is looking for some dependent library and it needs to be set within the web server environment.
chilidevelopera at 2007-7-12 19:33:30 > top of Java-index,Web & Directory Servers,Web Servers...
# 6
This is PHP Add-on we've installed http://www.sun.com/download/products.xml?id=45c26bc9
Aeon_Lancera at 2007-7-12 19:33:30 > top of Java-index,Web & Directory Servers,Web Servers...
# 7

[nobr]I wrote a small php script (testmysql.php) :

<?

$username="root";

$password="abcd";

$database="mysql";

mysql_connect(localhost,$username,$password);

print "Connected <BR>";

mysql_close();

?>

I tested using command line php e.g

$ ../plugins/php/bin/php ./docs/php/testmysql.php

X-Powered-By: PHP/5.2.0, Sun add-on 1.0

Content-type: text/html

Connected

And tested inside webserver using uri /php/testmysql.php

and it worked fine.

Can you see if you can connect mysql with command line php and test this basic

script to see if works.

I configured my webserver as nsapi. I didn't test if it works with fastcgi php or not.[/nobr]

Basantka at 2007-7-12 19:33:30 > top of Java-index,Web & Directory Servers,Web Servers...
# 8

First ... what you can see in error log form webserver ? If PHP is compiled with mysql?

What you see in MySQL log?

Can you connect to tthis mysql server localy form command line?

I think all problems are between mysql and Webserver. Mayby some kind of FW or permision to DB settings.

Irek

ireneusz.tarnowskia at 2007-7-12 19:33:30 > top of Java-index,Web & Directory Servers,Web Servers...