This topic is locked

Need help with dbconnection on a hosted Mysql DB

8/25/2006 2:01:48 PM
PHPRunner General questions
R
rgman author

Does anyone know how to set up the dbcommon.php file to on a hosted server that was configured with cpanel. There is something different here. My user login and password are correct I can login successfully using mysql -u xxxx -p to the database.

<?php
These are the dbcommon setting I'm using. I think problen is the $host setting but I am not sure what to try next.
$user="xxxx";

$pwd="xxxxxxx";

$host="localhost";

$port="";

$sys_dbname="xxxx";
This is the error I get after I login in:
Warning: main(include/TransDet_variables.php): failed to open stream: No such file or directory in /usr/local/apache/htdocs/st626a/TransDet_list.php on line 10
Warning: main(): Failed opening 'include/TransDet_variables.php' for inclusion (include_path='.:/usr/lib/php:/usr/local/lib/php') in /usr/local/apache/htdocs/st626a/TransDet_list.php on line 10
Warning: main(include/TransDet_functions.php): failed to open stream: No such file or directory in /usr/local/apache/htdocs/st626a/TransDet_list.php on line 11
Warning: main(): Failed opening 'include/TransDet_functions.php' for inclusion (include_path='.:/usr/lib/php:/usr/local/lib/php') in /usr/local/apache/htdocs/st626a/TransDet_list.php on line 11
Fatal error: Call to undefined function: checkfiletime() in /usr/local/apache/htdocs/st626a/TransDet_list.php on line 12

jwoker 8/25/2006

When you say it's a hosted server that means it is not your personal server or pc which is what localhost would be used for. Try putting in either the hosted server's ip or your domain name -- xxx.xxx.xxx.xxx or mysite.com .

R
rgman author 8/25/2006

When you say it's a hosted server that means it is not your personal server or pc which is what localhost would be used for. Try putting in either the hosted server's ip or your domain name -- xxx.xxx.xxx.xxx or mysite.com .


Thanks for the responce. I tried both options but they did not work. I am using a dedicated sever at goddady the system comes pre-configured with a contol panel called cpanel. I used it to upgade mysql to 5.0.xx and I have verified that appach and mysql are up and running. I created a test PHP to debug the problem out side of PHP Runner.
<?php

// Connecting, selecting database

$link = mysql_connect('vault.rgsecure.net', 'xxxx', 'xxxxxx')

or die('Could not connect: ' . mysql_error());

echo 'Connected successfully';

mysql_select_db('st626') or die('Could not select database');
// Performing SQL query

$query = 'SELECT * FROM cont_inf';

$result = mysql_query($query) or die('Query failed: ' . mysql_error());
// Printing results in HTML

echo "<table>\n";

while ($line = mysql_fetch_array($result, MYSQL_ASSOC)) {

echo "\t<tr>\n";

foreach ($line as $col_value) {

echo "\t\t<td>$col_value</td>\n";

}

echo "\t</tr>\n";

}

echo "</table>\n";
// Free resultset

mysql_free_result($result);
// Closing connection

mysql_close($link);

?>
This is the error I get when I use the full qulified name configured on the server.
Warning: mysql_connect(): Host 'vault.rgsecure.net' is not allowed to connect to this MySQL server in /usr/local/apache/htdocs/test/connect.php on line 3

Could not connect: Host 'vault.rgsecure.net' is not allowed to connect to this MySQL server
When I putt in in either the hosted server's ip or your domain name -- xxx.xxx.xxx.xxx or rgsecure.net .
I get an error indicating that the server was not found.
Is there something in MYSQL that I need to do?

A
amirgulamali 8/25/2006

Hey,
Try consulting this page:
Verifying your MySQL Information

http://www.phplivesupport.com/documentatio...hp?aid=35&pid=1
It explains how to verify your databse connection. Upload the php file on your server and test the connection with your hostname, username and password. Hope that helps, it helped me so thought of sharing it.
If it has nothing to do with PHPRunner, i suggest you contact godaddy to find out the exact db details
Goodluck
-----------------

Amir

R
rgman author 8/26/2006

Hey,

Try consulting this page:
Verifying your MySQL Information

http://www.phplivesupport.com/documentatio...hp?aid=35&pid=1
It explains how to verify your databse connection. Upload the php file on your server and test the connection with your hostname, username and password. Hope that helps, it helped me so thought of sharing it.
If it has nothing to do with PHPRunner, i suggest you contact godaddy to find out the exact db details
Goodluck
-----------------

Amir


Amir,
I down loaded the testdb.php app it was very helpful. I didn't connect at first until I Granted all to root@localhost. Now testdb passes and connect to the database. I made the changes to the dbcommon but PHPRunner is not connecting after the login. The error is the same.
Warning: main(include/TransDet_variables.php): failed to open stream: No such file or directory in /usr/local/apache/htdocs/st626a/TransDet_list.php on line 10
Warning: main(): Failed opening 'include/TransDet_variables.php' for inclusion (include_path='.:/usr/lib/php:/usr/local/lib/php') in /usr/local/apache/htdocs/st626a/TransDet_list.php on line 10
Warning: main(include/TransDet_functions.php): failed to open stream: No such file or directory in /usr/local/apache/htdocs/st626a/TransDet_list.php on line 11
Warning: main(): Failed opening 'include/TransDet_functions.php' for inclusion (include_path='.:/usr/lib/php:/usr/local/lib/php') in /usr/local/apache/htdocs/st626a/TransDet_list.php on line 11
Fatal error: Call to undefined function: checkfiletime() in /usr/local/apache/htdocs/st626a/TransDet_list.php on line 12
<?php
These are the setting in dbcommon.php they should work they work in testdb.php
$user="xxx";

$pwd="xxxxx";

$host="localhost";

$port="";

$sys_dbname="st626";
I am not sure what to try next. I still think it's failing to connect to the Data base.

jwoker 8/26/2006

~~You might check that your server localhost or whatever has been granted access to mysql. In cpanel on the mysql page at the bottom is a section called host access where you can grant access to various ip's. Also, you might try installing one of the Fantastico applications and see if it's connect to database script is able to connect.
Have you tried the phprunner.php method of connecting to the db?~~
oops, I didn't see your post above. looks like you should troubleshoot the php errors <img src='https://asprunner.com/forums/file.php?topicimage=1&fieldname=reply&id=10681&image=1&table=forumreplies' class='bbc_emoticon' alt=':huh:' />
Good luck