ID: 48793 Comment by: ninzya at inbox dot lv Reported By: memoimyself at yahoo dot com dot br Status: Open Bug Type: *General Issues Operating System: WinXP SP3 PHP Version: 5.3.0 New Comment:
I guess this is your browser's activity. PHP itself does not deal with 'user hint' redirections by prepending or appending www's and com's to the requested host. Your browser, probably, reacts to HTTP 500 error code and attempts a redirection to probably valid location of www.localhost.com. Anyway, look at the access.log of apache, see what's the apache's response code to your request. Another guess may be is that the PHP is failing (segfaulting) with error_log, which leads to connection interruption between your browser and web server. Then browser attempts to connect to www.localhost.com... Anyway, redirection is being done by your browser. Previous Comments: ------------------------------------------------------------------------ [2009-07-04 21:10:31] memoimyself at yahoo dot com dot br Q: Is your apache server on 8080 port? A: Nope, 80. My httpd.conf is pretty straightforward and uses default values. Please note that Apache serves pure HTML (as well as other files) normally. Things only get weird when PHP is involved AND error_log is set in php.ini. ------------------------------------------------------------------------ [2009-07-04 20:02:22] ninzya at inbox dot lv Is your apache server on 8080 port? ------------------------------------------------------------------------ [2009-07-03 18:43:47] memoimyself at yahoo dot com dot br Description: ------------ Set-up: WinXP SP3, PHP 5.3.0, Apache 2.2.11 This is a truly bizarre problem, but I've done a lot of testing and do believe it's a bug. A few days ago I updated my test server to PHP 5.3.0. After doing that, even though Apache had not been touched in any way, all URLs containing 'localhost' pointing to PHP files (e.g. 'http://localhost/whatever.php') started being redirected to 'www.localhost.com' (e.g. 'http://www.localhost.com/whatever.php'). At first it didn't even occur to me that the problem could have anything to do with PHP. I checked 'c:\windows\system32\drivers\etc\hosts' and it still contained a line for '127.0.0.1 localhost'. I checked my network adapter configuration and IPv6 had not been added as a protocol. My Apache configuration files were untouched. I spent two days searching high and low for a possible cause, and along the way realized that the problem only occurred when PHP was involved: HTML files were being served without any redirection issues. When I replaced php.ini with an old version from a backup and everything went back to normal, so I fired up a diff application and, bit by bit, started replacing the contents of the newer php.ini with lines from the old one. I finally isolated the problem: the error_log line, which specified the absolute path to a log file (the same path that had been working fine with previous PHP versions). When the line is commented out, the redirection problem goes away. I double-checked the existence of the log file and made sure it was writable. I then tried moving it to a different directory (updating php.ini accordingly), but that didn't work either. I also tried changing the path from "C:\Apache\logs\php_error.log" to "file:///C:/Apache/logs/php_error.log" and that did make the redirection problem go away, but no errors are actually logged, even though 'log_errors' is properly set to 'On'. If I set error_log back to "C:\Apache\logs\php_error.log", the redirection issues comes back. Reproduce code: --------------- Line in php.ini: error_log = "C:\Apache\logs\php_error.log" Expected result: ---------------- Errors should be logged as usual. Actual result: -------------- Errors are not logged. Whether or not code contains any errors, browser (both IE and Firefox) gets redirected from http://localhost/path/to/script to http://www.localhost.com/path/to/script. ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=48793&edit=1