#40579 [Opn->Fbk]: $_SERVER['SERVER_PORT'] is invalid during apache redirect

From: Date: Fri, 23 Mar 2007 11:10:51 +0000
Subject: #40579 [Opn->Fbk]: $_SERVER['SERVER_PORT'] is invalid during apache redirect
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-110729@lists.php.net to get a copy of this message
ID: 40579 Updated by: tony2001@php.net Reported By: ruslan dot kyrychuk at gmail dot com -Status: Open +Status: Feedback Bug Type: *Web Server problem Operating System: Windows 2003 PHP Version: 5.2.1 New Comment: Works just fine here. ["SERVER_PORT"]=> string(4) "8887" ["SCRIPT_NAME"]=> string(11) "/index.html" Previous Comments: ------------------------------------------------------------------------ [2007-03-23 10:58:01] ruslan dot kyrychuk at gmail dot com Reproduce code: --------------- 1. Configure Apache to use port 8080 2. Create .htaccess file: Options +FollowSymLinks -Indexes RewriteEngine on RewriteCond %{REQUEST_FILENAME} (.+)\.html RewriteRule ^(.+)$ test.php [QSA,L] 3. Create test.php file <?php echo $_SERVER['SERVER_PORT']; ?> Run http://localhost:8080/test.html Output: 80 Run http://localhost:8080/test.php Output: 8080 ------------------------------------------------------------------------ [2007-03-01 01:00:01] php-bugs at lists dot php dot net No feedback was provided for this bug for over a week, so it is being suspended automatically. If you are able to provide the information that was originally requested, please do so and change the status of the bug back to "Open". ------------------------------------------------------------------------ [2007-02-21 14:47:25] tony2001@php.net Thank you for this bug report. To properly diagnose the problem, we need a short but complete example script to be able to reproduce this bug ourselves. A proper reproducing script starts with <?php and ends with ?>, is max. 10-20 lines long and does not require any external resources such as databases, etc. If the script requires a database to demonstrate the issue, please make sure it creates all necessary tables, stored procedures etc. Please avoid embedding huge scripts into the report. ------------------------------------------------------------------------ [2007-02-21 14:37:51] ruslan dot kyrychuk at gmail dot com Description: ------------ With apache redirects (mode_rewrite) then in $_SERVER['SERVER_PORT'] is always 80, even if Apache server is working on another port. Reproduce code: --------------- While apache redirect with following rewrite rule RewriteRule ^(.+)$ index.php [QSA,L] Then $_SERVER['SERVER_PORT'] is "80" --- P.S. While RewriteRule ^(.+)$ index.php [E=PORT:%{SERVER_PORT},QSA,L] then $_SERVER['REDIRECT_PORT'] is "8080" So it looks like redirected value is sending correctly but doesn't save correctly into $_SERVER array. Expected result: ---------------- RewriteRule ^(.+)$ index.php [QSA,L] During redirecting $_SERVER['SERVER_PORT'] must be correct port. Actual result: -------------- $_SERVER['SERVER_PORT'] is always "80" during apache redirect. ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=40579&edit=1

« previous php.bugs (#110729) next »