yshua Posted October 6, 2012 Share Posted October 6, 2012 Dear php people: Have an Apache2.2, MySQL5.1.65, PHP5.3.8, Win7 and recently succeeded in configuring it. But when entering data on a screen and hit the submit button to run the program to do my mysql_connect in line, as usual, the IP address cable was disconnected! The following emsg resulted and restarting Apache, and webserver boot failed to get the error cleared. Warning: mysql_connect() [C:\Users\Headache2\downloads\php_enhanced_enfunction.mysql-connect.chm]: [2002] No connection could be made because the target machine actively refused it. (trying to connect via tcp://localhost:3306) in C:\Program Files (x86)\Apache Software Foundation\ Apache2.2\htdocs\includes\db.php on line 2 Warning: mysql_connect() [C:\Users\Headache2\downloads\php_enhanced_enfunction.mysql-connect.chm]: No connection could be made because the target machine actively refused it. in C:\Program Files (x86)\Apache Software Foundation\Apache2.2\htdocs\includes\db.php on line 2 Could not connect: No connection could be made because the target machine actively refused it. Would checking phpinfo.php show some setting that is needed changing? Please need to have any ideas on what to try. Sincerely, Yshua Quote Link to comment Share on other sites More sharing options...
Christian F. Posted October 6, 2012 Share Posted October 6, 2012 Tried following the suggestion in the error message? It lists the filenames and all. Also, without knowing what you've done (code-wise) we cannot tell you what you need to do to fix it. With only the error message, most of the time we can just tell you what it has already stated. PS: It's the "Ethernet cable", or "TP cable", not "IP address cable". Quote Link to comment Share on other sites More sharing options...
Pikachu2000 Posted October 6, 2012 Share Posted October 6, 2012 No connection could be made because the target machine actively refused it. (trying to connectvia tcp://localhost:3306) That error doesn't have anything to do with the network cable being disconnected. Quote Link to comment Share on other sites More sharing options...
yshua Posted October 6, 2012 Author Share Posted October 6, 2012 (edited) OK, ChristianF: Here is the docile, previously checked out code. Ran well before.... <?php $mysql = mysql_connect('localhost', 'root', 'mypassword'); if (!$mysql) { die('Could not connect: ' . mysql_error()); } $db_selected = mysql_select_db('mydatabase', $mysql); if (!$db_selected) { die ('Can\'t use Selected Database : ' . mysql_error()); } ?> But, honestly, it is back up and running again by having to reinstall MySQL5.1.65! And Pikachu2000 said, "That error doesn't have anything to do with the network cable being disconnected." You misread, or my explanation was unclear to you.... My ethernet cable was inadvertently disconnected when I entered data from a screen on the webserver. Then the server crashed. Then the same screen kept giving that big emsg, regardless what I could do. Does php.ini need to be changed possibly. Oh, also, MySQL refused me to sign on again, if this helps. Thanks, all, Yshua Edited October 6, 2012 by yshua Quote Link to comment Share on other sites More sharing options...
Christian F. Posted October 7, 2012 Share Posted October 7, 2012 He didn't misunderstand, but the problem could be caused by the server crash (which you didn't mention before). In any case, there's clearly either nothing listening on the port on the localhost, or there's a firewall blocking it. Double (triple) check that the login connection details are correct, and that your MySQL is indeed using the default port. Then verify that the server is actually running, and listening on that port. Lastly, check your server's firewall, and make sure it allows traffic from localhost on that port. You might want to get someone who knows servers and networking to help you out with this though. PS: "php.ini" has nothing to do with this. Quote Link to comment Share on other sites More sharing options...
yshua Posted October 10, 2012 Author Share Posted October 10, 2012 Dear ChristianF: Thanks so much for the brilliant observation that the Windows firewall might be blocking the 5.1.65 version of MySQL noinstall! Finally it dawned on me to check the Control Panel System and Security option, and then the "Allow a program through Windows Firewall" option. MySQL is disallowed as a program to allow on Win7 because of its "noinstall!" Does anyone know a workaround of this? Server down, Yshua Quote Link to comment Share on other sites More sharing options...
Christian F. Posted October 10, 2012 Share Posted October 10, 2012 Yes, change the firewall rules to allow it through. (Only for localhost though!) Should be plenty of guides on the web on how to do this for the Windows firewall. Quote Link to comment 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.