problem with mysql_connect()

Problems with the Windows version of XAMPP, questions, comments, and anything related.

problem with mysql_connect()

Postby AAA123 » 25. May 2015 17:58

My all scripts php-portable Xampp 1.8.3 - some day HAS STOPPED to connect to the database on localhost
- Mysql_connect () - "Can not connect to MySQL"
Nothing has changed, still in "php.ini" engine = on, everything the same.

Now I can only connect to my databases by client program MySQL-Front.
Also, the scripts did mysql_connect() well when using the light package xampp-win32-1.7.7-usb-lite

For some time there have been problems with the stability and security of Windows 7 that is.
system32/roboot.exe hired dllhost.exe (COM Surrogate), but I removed roboot.exe and other bugs and windows works well.
The reinstallation of Xampp-portable 1.8.3 nothing improves. Has anyone had a similar problem?
AAA123
 
Posts: 15
Joined: 30. December 2010 12:52

Re: problem with mysql_connect()

Postby Altrea » 25. May 2015 18:21

We need full error messages with error code
We don't provide any support via personal channels like PM, email, Skype, TeamViewer!

It's like porn for programmers 8)
User avatar
Altrea
AF Moderator
 
Posts: 8290
Joined: 17. August 2009 13:05
XAMPP version: several
Operating System: Windows 10 Pro x64

Re: problem with mysql_connect()

Postby AAA123 » 25. May 2015 19:43

The case is that execution of simple script produces no errors in mysql_error.log, and no line in apache/logs/acces.log , error.log . Tha fail is at the very beginning at
<?php //
mysql_connect ("localhost", "root", "haslo") or die ("Nie można poł±czyć się z MySQL");
mysql_select_db ("cwphp4") or die ("Nie można poł±czyć się z baz± cwphp4");
....
AND SCREEN DISPLAY:
Warning: mysql_connect(): in C:\xampp-portable\htdocs\cwphp4\4-26.php on line 7

Warning: mysql_connect(): in C:\xampp-portable\htdocs\cwphp4\4-26.php on line 7

Nie można połączyć się z MySQL (cannot connect to MySQL)
AAA123
 
Posts: 15
Joined: 30. December 2010 12:52

Re: problem with mysql_connect()

Postby Altrea » 25. May 2015 20:01

Use mysql_error() and mysql_errno() to output full messages and error code.
We don't provide any support via personal channels like PM, email, Skype, TeamViewer!

It's like porn for programmers 8)
User avatar
Altrea
AF Moderator
 
Posts: 8290
Joined: 17. August 2009 13:05
XAMPP version: several
Operating System: Windows 10 Pro x64

Re: problem with mysql_connect()

Postby AAA123 » 25. May 2015 20:19

Atrea -You cannot get any info this way because (manual):
"The MySQL connection. If the link identifier is not specified, the last link opened by mysql_connect() is assumed. If no such link is found, it will try to create one as if mysql_connect() was called with no arguments. If no connection is found or established, an E_WARNING level error is generated."
In other words mysql_connect() must be succesfull, so I got no info
Code: Select all
$link = mysql_connect ("localhost", "root", "haslo");
echo mysql_errno($link) . ": " . mysql_error($link). "\n";

---------------------
Probably something is wrong with httpd.exe

COMODO Firewall Defense+ has blocked the events as follows:

Application : c:\xamp-portable\apache\bin\httpd.exe
Action : modification of the key
direction : HKLM\SYSTEM\ControlSet001\Services\Tcpip\Parameters
AAA123
 
Posts: 15
Joined: 30. December 2010 12:52

Re: problem with mysql_connect()

Postby Nobbie » 25. May 2015 21:20

AAA123 wrote:Probably something is wrong with httpd.exe


Funny! There is only one thing with a 100% chance: that there is NOTHING wrong with httpd.exe
Nobbie
 
Posts: 8768
Joined: 09. March 2008 13:04

Re: problem with mysql_connect()

Postby AAA123 » 25. May 2015 21:26

So what a process tries to change registers ?
AAA123
 
Posts: 15
Joined: 30. December 2010 12:52

Re: problem with mysql_connect()

Postby Altrea » 25. May 2015 21:28

AAA123 wrote:In other words mysql_connect() must be succesfull, so I got no info

Is that true? Simple test

Code: Select all
<?php
mysql_connect('localhost', 'mysql_user', 'mysql_password') or die('Could not connect (' . mysql_errno() . '): ' . mysql_error());


If MySQL is not started or could not get reached
Could not connect (2002): Es konnte keine Verbindung hergestellt werden, da der Zielcomputer die Verbindung verweigerte.


If Username/Password is not correct
Could not connect (1045): Access denied for user 'mysql_user'@'localhost' (using password: YES)
We don't provide any support via personal channels like PM, email, Skype, TeamViewer!

It's like porn for programmers 8)
User avatar
Altrea
AF Moderator
 
Posts: 8290
Joined: 17. August 2009 13:05
XAMPP version: several
Operating System: Windows 10 Pro x64

Re: problem with mysql_connect()

Postby AAA123 » 25. May 2015 21:48

Yes that's good idea to place diagnostic inside the die().
So I got the message:
Could not connect (2002): php_network_getaddresses: getaddrinfo failed:
During the search the database unrecoverable error occurred.
AAA123
 
Posts: 15
Joined: 30. December 2010 12:52


Return to XAMPP for Windows

Who is online

Users browsing this forum: No registered users and 93 guests