phpvox Posted June 14, 2007 Share Posted June 14, 2007 as soon as i upgraded from PHP4 to PHP5 and i started getting the bellow error, its not connecting to the database no more, files and setting are the same.....this is a compatibility issue, how can i get a fix around this ??? i cant post the script here, its too big.....any help ??? ......thanks Warning: mysql() [function.mysql]: Access denied for user 'apache'@'localhost' (using password: NO) Quote Link to comment https://forums.phpfreaks.com/topic/55536-fix-for-this-issue/ Share on other sites More sharing options...
mmarif4u Posted June 14, 2007 Share Posted June 14, 2007 It means that your connection to mysql is dead, It has no issue with php, Try to make a user name and password in mysql and then use it in php coding. Quote Link to comment https://forums.phpfreaks.com/topic/55536-fix-for-this-issue/#findComment-274430 Share on other sites More sharing options...
phpvox Posted June 14, 2007 Author Share Posted June 14, 2007 well why does it work as soon as i down grade to PHP4 and it works.......i have to upgrade to PHP5 the script is encoded and im not getting support from the vendor. i think i have to change something in mysql Quote Link to comment https://forums.phpfreaks.com/topic/55536-fix-for-this-issue/#findComment-274433 Share on other sites More sharing options...
mmarif4u Posted June 14, 2007 Share Posted June 14, 2007 I think your connectivity code older try to update that code. May it will solve this problem. Quote Link to comment https://forums.phpfreaks.com/topic/55536-fix-for-this-issue/#findComment-274438 Share on other sites More sharing options...
phpvox Posted June 14, 2007 Author Share Posted June 14, 2007 what code ? where do i find that ?? Quote Link to comment https://forums.phpfreaks.com/topic/55536-fix-for-this-issue/#findComment-274446 Share on other sites More sharing options...
mmarif4u Posted June 14, 2007 Share Posted June 14, 2007 The code where u connect to mysql. Quote Link to comment https://forums.phpfreaks.com/topic/55536-fix-for-this-issue/#findComment-274454 Share on other sites More sharing options...
phpvox Posted June 14, 2007 Author Share Posted June 14, 2007 it has nothing to do with it............it works when i downgrade to php4.....its not the setting in the conf file, its the same info........ <xml> </section> <section name="DATABASE CONFIGURATION"> <field type="select" name="db_type" text="Select your database type" help="http://www.ThisWasRemovedByMe.com/products/ThisWasRemovedByMe/documentation/system_configuration.html#select_your_database_type">MySQL<enum val="MySQL">1</enum> </field> <field required="1" type="edit" name="db_host" text="Your database host" help="http://www.ThisWasRemovedByMe.com/products/ThisWasRemovedByMe/documentation/system_configuration.html#your_database_host">localhost</field> <field required="1" type="edit" name="db_login" text="Your database username" help="http://www.ThisWasRemovedByMe.com/products/ThisWasRemovedByMe/documentation/system_configuration.html#your_database_username">REMOVED</field> <field type="edit" name="db_pswd" text="Your database password" help="http://www.ThisWasRemovedByMe.com/products/ThisWasRemovedByMe/documentation/system_configuration.html#your_database_password">REMOVED</field> <field required="1" type="edit" name="db_name" text="Database name" help="http://www.ThisWasRemovedByMe.com/products/ThisWasRemovedByMe/documentation/system_configuration.html#database_name">REMOVED</field> </section> </xml> Quote Link to comment https://forums.phpfreaks.com/topic/55536-fix-for-this-issue/#findComment-274458 Share on other sites More sharing options...
phpvox Posted June 14, 2007 Author Share Posted June 14, 2007 anybody ? :'( Quote Link to comment https://forums.phpfreaks.com/topic/55536-fix-for-this-issue/#findComment-274732 Share on other sites More sharing options...
Nhoj Posted June 14, 2007 Share Posted June 14, 2007 Your script clearly isn't connecting to the database. The problem is more than likely one of the following. 1) Your MySQL settings are incorrect 2) Your PHP configuration is a little messy after the upgrade, you might even have register_globals on before and off after, who knows. 3) Your script is most likely using a very outdated set of mysql functions. Quote Link to comment https://forums.phpfreaks.com/topic/55536-fix-for-this-issue/#findComment-274737 Share on other sites More sharing options...
phpvox Posted June 14, 2007 Author Share Posted June 14, 2007 I would do with #3......... setting are everything eles is the same, this happenes when i click and upgrade to PHP 5....i get that error on line 19 <? $connected = false; function c() { global $db_host, $db_login, $db_pswd; $db = @mysql_connect($db_host, $db_login, $db_pswd); $connected = true; return $db; } function q($q_str) { global $db_name, $connected; if(!$connected) { c(); } $r = mysql($db_name, $q_str); return $r; } function d($db) { @mysql_close($db); } function e($r) { if(@mysql_numrows($r)) return 0; else return 1; } function f($r){ return @mysql_fetch_array($r); } function nr($r){ return @mysql_num_rows($r); } ?> Quote Link to comment https://forums.phpfreaks.com/topic/55536-fix-for-this-issue/#findComment-274773 Share on other sites More sharing options...
phpvox Posted June 14, 2007 Author Share Posted June 14, 2007 did u look at it ? Quote Link to comment https://forums.phpfreaks.com/topic/55536-fix-for-this-issue/#findComment-274874 Share on other sites More sharing options...
Nhoj Posted June 14, 2007 Share Posted June 14, 2007 Try changing: function q($q_str) { global $db_name, $connected; if(!$connected) { c(); } $r = mysql($db_name, $q_str); return $r; } to function q($q_str) { global $connected; if(!$connected) { c(); } $r = mysql_query($q_str); return $r; } and $connected = false; function c() { global $db_host, $db_login, $db_pswd; $db = @mysql_connect($db_host, $db_login, $db_pswd); $connected = true; return $db; } to $connected = false; function c() { global $db_host, $db_login, $db_name, $db_pswd; $db = @mysql_connect($db_host, $db_login, $db_pswd); @mysql_select_db($db_name) or die('MySQL Error: Could not locate the specified database'); $connected = true; return $db; } Quote Link to comment https://forums.phpfreaks.com/topic/55536-fix-for-this-issue/#findComment-274890 Share on other sites More sharing options...
phpvox Posted June 14, 2007 Author Share Posted June 14, 2007 i got the error msg MySQL Error: Could not locate the specified database Quote Link to comment https://forums.phpfreaks.com/topic/55536-fix-for-this-issue/#findComment-274980 Share on other sites More sharing options...
phpvox Posted June 15, 2007 Author Share Posted June 15, 2007 MySQL Error: Could not locate the specified database Quote Link to comment https://forums.phpfreaks.com/topic/55536-fix-for-this-issue/#findComment-275034 Share on other sites More sharing options...
Nhoj Posted June 15, 2007 Share Posted June 15, 2007 Try changing the last one to: $connected = false; function c() { global $db_host, $db_login, $db_name, $db_pswd; $dbconn = @mysql_connect($db_host, $db_login, $db_pswd); @mysql_select_db($db_name, $dbconn) or die('MySQL Error: Could not locate the specified database'); $connected = true; return $dbconn; } Also make sure your $db_name variable is set to the name of the mysql database. Quote Link to comment https://forums.phpfreaks.com/topic/55536-fix-for-this-issue/#findComment-275083 Share on other sites More sharing options...
phpvox Posted June 15, 2007 Author Share Posted June 15, 2007 how can i do that ? Quote Link to comment https://forums.phpfreaks.com/topic/55536-fix-for-this-issue/#findComment-275105 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.