itdmacar Posted December 23, 2007 Share Posted December 23, 2007 Hi, Can please someone help me . . . I have been using the old version of PHP & MYSQL using Windows XP in my deskstop with out problem even at the start of installation. I just bought a new laptop it comes with Windows Vista on it. I have downloaded the latest version of Apache (2.0.61 win 32), PHP (5.2.5) and Mysql (5.0.45) my problem is whenever is tried to connect to my database it does not work and worst of all does not give me any hint at all whats the problem to fix it here's my code <?php echo 'a'; mysql_connect("localhost", "rootadd", "reane") or die(mysql_error()); echo "Connected to MySQL<br />"; mysql_select_db("test") or die(mysql_error()); echo "Connected to Database"; ?> Output is just a. even if I modify the user and password to be different its the same output. I remember in my desktop at least it will tell me that the user does not exist or the password is wrong . . . Is this just a configuration issue ? if yes, can you please let me know which one to adjust . . . Is there other way to check if MYSQL is working properly ? Any solution or test that I can do to show the errors ? Thanks you very much . . . Ron Quote Link to comment Share on other sites More sharing options...
PHP_PhREEEk Posted December 23, 2007 Share Posted December 23, 2007 in my.ini, add the following line: old-passwords Kill the MySQL service, then restart it. PhREEEk Quote Link to comment Share on other sites More sharing options...
crashmaster Posted December 23, 2007 Share Posted December 23, 2007 I can reccomend you to use EasyPHP... I have VISTA too, and I dont have any probelm with it.... )) Good Luck Quote Link to comment Share on other sites More sharing options...
itdmacar Posted December 23, 2007 Author Share Posted December 23, 2007 Thanks for reply . . . PHP_PhREEEk, I did try it same error, it seems its terminated when it hits the mysql_connect, by right it should display mysql_Error. crashmaster, I wait first if others have the same problem else need to reinstall all over again . . . Any more idea ? Quote Link to comment Share on other sites More sharing options...
PHP_PhREEEk Posted December 23, 2007 Share Posted December 23, 2007 Interesting that echo "Connected to MySQL isn't printing, so that means that the script is dealt a fatality at the connect request... yet no error... hmm... Shall we try: <?php echo 'a'; if ( !mysql_connect("localhost", "rootadd", "reane") ) { echo 'Could not connect to MySQL! Error: ' . mysql_error(); } else { echo "Connected to MySQL!"; } mysql_select_db("test") or die(mysql_error()); echo "Connected to Database"; ?> Post back output... PhREEEk Quote Link to comment Share on other sites More sharing options...
itdmacar Posted December 23, 2007 Author Share Posted December 23, 2007 Thanks, I did copied your code and tried it again, it's the same results, just output a, strange .. Quote Link to comment Share on other sites More sharing options...
PHP_PhREEEk Posted December 23, 2007 Share Posted December 23, 2007 Welp, ya got me... are you sure the MySQL service is running? Can you open an instance of Command Prompt and type mysql at the prompt? Tell me what happens... PhREEEk Quote Link to comment Share on other sites More sharing options...
itdmacar Posted December 23, 2007 Author Share Posted December 23, 2007 You could be right . . . I am not sure but if this running, if I type mysql at cmd line hit enter if brings me to MySQL admin then I type my users and password then the status is MySQL server is running . . . Quote Link to comment Share on other sites More sharing options...
itdmacar Posted December 23, 2007 Author Share Posted December 23, 2007 Sorry, I used Dreamweaver MX to check my codes . . . Quote Link to comment Share on other sites More sharing options...
wildteen88 Posted December 23, 2007 Share Posted December 23, 2007 Make sure you have configured PHP to use the mysql extension, by default PHP5 does not come with mysql builtin (like PHP4 did). Also you'll need to enable the display_errors directive within the php.ini in order for PHP to return any errors during runtime, by default this setting is disabled but PHP will log errors via Apaches error log. To see if the mysql extension has been enabled you can run the following simple script: <?php phpinfo(); ?> That will produce a page full of PHPs current configuration/environment. Scroll down and see if you can find a MySQL heading. If you can't find a MySQL heading then the mysql extension is not enabled and thus your code just outputs "a". Please read this FAQ for doing so. Quote Link to comment Share on other sites More sharing options...
itdmacar Posted December 23, 2007 Author Share Posted December 23, 2007 I did try it but it seems it could not recognize my SQL, same error , I gonno double check it again, I might go back to PHP4 version instead if this does not work . . . Thanks for all the replies . . . Quote Link to comment Share on other sites More sharing options...
itdmacar Posted December 23, 2007 Author Share Posted December 23, 2007 I have switched on all the error logs, here is the error . . . Fatal error: Call to undefined function mysql_connect() in C:\server\Apache Group\Apache2\htdocs\localtown\TMP6ktvtigcu.php on line 3 Quote Link to comment Share on other sites More sharing options...
wildteen88 Posted December 23, 2007 Share Posted December 23, 2007 The mysql extension still isn't enabled, did you follow the FAQ I linked to? What have you done so far? Quote Link to comment Share on other sites More sharing options...
itdmacar Posted December 23, 2007 Author Share Posted December 23, 2007 I think I did, here is my phpinfo look like, extension_dir c:\Server\Apache Group\Apache2\ext c:\Server\Apache Group\Apache2\ext Sorry, I pointed it to Apache instead of PHP, let me change it first and let you know the output . . . Quote Link to comment Share on other sites More sharing options...
wildteen88 Posted December 23, 2007 Share Posted December 23, 2007 What did you do with the file called libmysql.dll? the mysql extension relys on this library if PHP cannot find this file then the mysql extension wont load properly. By default libmysql.dll is located in your PHP installation folder. I'd advise you on adding your PHP folder to PATH environment variable. Quote Link to comment Share on other sites More sharing options...
itdmacar Posted December 23, 2007 Author Share Posted December 23, 2007 I did change it already but not so sure what to do libmysql.dll copied from MySQL folder and moved it to PHP folder but the notes says 'so make sure you have copied a file called libmysql.dll to the windows folder too' which windows folder ? Quote Link to comment Share on other sites More sharing options...
itdmacar Posted December 23, 2007 Author Share Posted December 23, 2007 Thanks for all the reply . . .managed to fix it. Just realized I have a missing ext folder, just copied it and tried it works now . . . 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.