while debugging, "connection to the server was reset"
After starting "listen to PHP connections" in phpstorm and then running firefox, I keep running into, "The connection to the server was reset while the page was loading."
When I set a breakpoint in the index file, phpstorm stops as expected at the breakpoint. I can also step through the code in that index file just fine, but the error happens when Util::redirect to a different php file is encountered.
Even more mysterious is the fact that I don't encounter this error on a different machine (both are linux environments: works fine in ubuntu 11.10, but the problem pops up in mint 12). Both environments have the same xdebug settings in the php.ini files.
???
Please sign in to leave a comment.
Here's my phpinfo results:
PHP Version 5.3.6-13ubuntu3.6
Copyright (c) 2006-2007 Hardened-PHP Project Copyright (c) 2007-2009 SektionEins GmbH
Zend Engine v2.3.0, Copyright (c) 1998-2011 Zend Technologies
with Xdebug v2.1.3, Copyright (c) 2002-2012, by Derick Rethans
PHP Credits
Configuration
apache2handler
Apache Environment
HTTP Headers Information
bcmath
bz2
calendar
Core
ctype
date
dba
dom
ereg
exif
fileinfo
filter
ftp
gd
gettext
hash
iconv
json
libxml
mbstring
mcrypt
mhash
mysql
mysqli
openssl
pcre
PDO
pdo_mysql
Phar
Phar fully realized by Gregory Beaver and Marcus Boerger.
Portions of tar implementation Copyright (c) 2003-2009 Tim Kientzle.
posix
Reflection
session
shmop
SimpleXML
soap
sockets
SPL
standard
sysvmsg
tokenizer
wddx
xdebug
xml
xmlreader
xmlwriter
zip
zlib
Additional Modules
Environment
PHP Variables
PHP License
This program is free software; you can redistribute it and/or modify it under the terms of the PHP License as published by the PHP Group and included in the distribution in the file: LICENSE
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
If you did not receive a copy of the PHP license, or have any questions about PHP licensing, please contact license@php.net.
Hello Thomas,
Could you please describe the implementation of Util::redirect?
Yeah, it could be environment specific issue.
Also could you please provide your xdebug log for machine with mint(http://xdebug.org/docs/remote#remote_log)?
Thank you for feedback!
oops! I should have provided the example files I'm using. I'll post the xdebug log file in the next reply.
Thanks Nikolay!
index.php:
--------------------------------------------------
<?php
require_once 'Util.php';
session_start ();
if ($_POST) {
$_SESSION ['data'] = $_POST ['data'];
Util::redirect ('displayData.php'); // CONNECTION RESET ERROR HERE
} // end if ($_POST)
?>
<form method="post" action="index.php">
data: <input type="text" name="data" /><br />
</form>
--------------------------------------------------
Util.php
--------------------------------------------------
<?php
class Util
{
public static function redirect($url)
{
if ($url) {
header("Location: " . $url);
exit();
}
}
}
--------------------------------------------------
displayData.php
--------------------------------------------------
<?php // displayData.php
session_start ();
echo $_SESSION ['data'];
--------------------------------------------------
And here is the corresponding xdebug log file ...
Attachment(s):
xdebug.log.zip
I've encountered this behavior. Try this as a workaround while debugging. Worked for me.
header("Refresh: " . $url);
Thanks for the suggestion Leighton, but it didn't work. I replaced:
header("Location: " . $url);
with:
header("Refresh: " . $url);
but still get the same server reset error. I'm guessing you aren't using Linux Mint (mine is vsn 12)?
... still scratching my head over this ...
Nope not on linux mint. The server xdebug is installed on is centOS 5. Debugging remotely from a win7 64bit machine. Sorry it didn't help. :)
Hi, Tomas,
Do you still have the issue?
It seems that I've finally found a cause - it is an issue with Xdebug, which was introduced since version 2.1.3 (http://bugs.xdebug.org/view.php?id=815). Please upgrade to Xdebug 2.2.0RC2.
Thank you for feedback!
Leighton,
Do you still have the issue? Please try to upgrade to Xdebug 2.2.0RC2.
Thank you for feedback!
NIkolay, thank you for your persistance with this issue. I will upgrade xdebug and report back.
By god the xdebug upgrade to 2.2.0RC2 solved the problem! After the upgrade, I can now single step past the header instruction to the target php file without a server reset.
=> THANK YOU NIKOLAY!