Question

I am working on a PHP website whose code I inherited from a development team. I am trying to get it to run properly on my local machine (Windows 7/Apache/Zend Studio), but I am having trouble with the login. Instead of directing me to the front page, it sends me to a blank screen with a bunch of debug info. If I then try again and manually go to the front page then it accurately shows my status as logged in. I have very few debugging leads except for a PHP error:

Source File: 
    C:\Program Files (x86)\Zend\Apache2\htdocs\weatherbell.com\public\fitch\lib\FJF_BASE.php : 113

Error String:
    Warning: Cannot modify header information - headers already sent by (output started at C:\Program Files (x86)\Zend\Apache2\htdocs\weatherbell.com\public\fitch\lib\FJF_BASE.php:28) in C:\Program Files (x86)\Zend\Apache2\htdocs\weatherbell.com\public\fitch\lib\FJF_BASE.php on line 113

Backtrace: enter image description here

Here is some additional debug info:

**FUNCTION DATA:**

Function Name: header
Function Arguments:
'Location: /'


**REQUEST:**

GET
array (
  'cmd' => 'login',
)
POST
array (
  'cmd' => 'login',
  'username' => '********'
  'password' => '********',
)
COOKIE
array (
  'PHPSESSID' => '2jhhjib1el57ic8jm62sokcpq7',
  'ZDEDebuggerPresent' => 'php,phtml,php3',
)


**SERVER VARIABLES:**

SERVER
array (
  'ALLUSERSPROFILE' => 'C:\\ProgramData',
  'APPDATA' => 'C:\\Windows\\system32\\config\\systemprofile\\AppData\\Roaming',
  'CLASSPATH' => '.;C:\\Program Files (x86)\\Java\\jre6\\lib\\ext\\QTJava.zip',
  'CommonProgramFiles' => 'C:\\Program Files (x86)\\Common Files',
  'CommonProgramFiles(x86)' => 'C:\\Program Files (x86)\\Common Files',
  'CommonProgramW6432' => 'C:\\Program Files\\Common Files',
  'COMPUTERNAME' => 'MIKE-PC',
  'ComSpec' => 'C:\\Windows\\system32\\cmd.exe',
  'COR_ENABLE_PROFILING' => '1',
  'COR_PROFILER' => 'MyProfiler',
  'CYGWIN' => 'tty',
  'DB2INSTANCE' => 'DB2',
  'FP_NO_HOST_CHECK' => 'NO',
  'GTK_BASEPATH' => 'C:\\Program Files (x86)\\GtkSharp\\2.12\\',
  'LOCALAPPDATA' => 'C:\\Windows\\system32\\config\\systemprofile\\AppData\\Local',
  'NUMBER_OF_PROCESSORS' => '2',
  'OS' => 'Windows_NT',
  'Path' => 'C:\\Users\\Mike\\AppData\\Local\\Google\\Chrome\\Application;C:\\Program Files (x86)\\PlayCap 0.1.1...cut...',
  'PATHEXT' => '.COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH;.MSC;.RB;.RBW',
  'PHPRC' => 'C:\\Program Files (x86)\\Zend\\ZendServer\\etc',
  'PHP_FCGI_MAX_REQUESTS' => '10000',
  'PROCESSOR_ARCHITECTURE' => 'x86',
  'PROCESSOR_ARCHITEW6432' => 'AMD64',
  'PROCESSOR_IDENTIFIER' => 'Intel64 Family 6 Model 23 Stepping 10, GenuineIntel',
  'PROCESSOR_LEVEL' => '6',
  'PROCESSOR_REVISION' => '170a',
  'ProgramData' => 'C:\\ProgramData',
  'ProgramFiles' => 'C:\\Program Files (x86)',
  'ProgramFiles(x86)' => 'C:\\Program Files (x86)',
  'ProgramW6432' => 'C:\\Program Files',
  'protector_attach' => 'true',
  'PSModulePath' => 'C:\\Windows\\system32\\WindowsPowerShell\\v1.0\\Modules\\',
  'PUBLIC' => 'C:\\Users\\Public',
  'QTJAVA' => 'C:\\Program Files (x86)\\Java\\jre6\\lib\\ext\\QTJava.zip',
  'SAN_DIR' => 'C:\\Program Files\\SiSoftware\\SiSoftware Sandra Lite 2012.SP5',
  'SystemDrive' => 'C:',
  'SystemRoot' => 'C:\\Windows',
  'TEMP' => 'C:\\Users\\Mike\\AppData\\Local\\Temp',
  'TMP' => 'C:\\Windows\\TEMP',
  'USERDOMAIN' => 'WORKGROUP',
  'USERNAME' => 'MIKE-PC$',
  'USERPROFILE' => 'C:\\Windows\\system32\\config\\systemprofile',
  'VS100COMNTOOLS' => 'E:\\Microsoft Visual Studio 10.0\\Common7\\Tools\\',
  'windir' => 'C:\\Windows',
  'windows_tracing_flags' => '3',
  'AP_PARENT_PID' => '3828',
  '_FCGI_CLIENT_PID_' => '5632',
  '_FCGI_MUTEX_' => '1444',
  '_FCGI_NTAUTH_IMPERSONATE_' => '1',
  '_FCGI_SHUTDOWN_EVENT_' => '1440',
  'FCGI_ROLE' => 'RESPONDER',
  'REDIRECT_STATUS' => '200',
  'HTTP_HOST' => 'localhost',
  'HTTP_CONNECTION' => 'keep-alive',
  'CONTENT_LENGTH' => '37',
  'HTTP_CACHE_CONTROL' => 'max-age=0',
  'HTTP_ORIGIN' => 'http://localhost',
  'HTTP_USER_AGENT' => 'Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.1 (KHTML, like Gecko) Chrome/21.0.1180...cut...',
  'CONTENT_TYPE' => 'application/x-www-form-urlencoded',
  'HTTP_ACCEPT' => 'text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8',
  'HTTP_REFERER' => 'http://localhost/login/',
  'HTTP_ACCEPT_ENCODING' => 'gzip,deflate,sdch',
  'HTTP_ACCEPT_LANGUAGE' => 'en-US,en;q=0.8',
  'HTTP_ACCEPT_CHARSET' => 'ISO-8859-1,utf-8;q=0.7,*;q=0.3',
  'HTTP_COOKIE' => 'PHPSESSID=2jhhjib1el57ic8jm62sokcpq7; ZDEDebuggerPresent=php,phtml,php3',
  'PATH' => 'C:\\Program Files (x86)\\PlayCap 0.1.1\\bin;C:\\Program Files\\Java\\jdk1.7.0_05\\bin;C:\\Program ...cut...',
  'COMSPEC' => 'C:\\Windows\\system32\\cmd.exe',
  'WINDIR' => 'C:\\Windows',
  'SERVER_SIGNATURE' => '',
  'SERVER_SOFTWARE' => 'Apache',
  'SERVER_NAME' => 'localhost',
  'SERVER_ADDR' => '127.0.0.1',
  'SERVER_PORT' => '80',
  'REMOTE_ADDR' => '127.0.0.1',
  'DOCUMENT_ROOT' => 'C:/Program Files (x86)/Zend/Apache2/htdocs/weatherbell.com/public',
  'SERVER_ADMIN' => 'webmaster@dummy-host.example.com',
  'SCRIPT_FILENAME' => 'C:/Program Files (x86)/Zend/Apache2/htdocs/weatherbell.com/public/fitch/index.php',
  'REMOTE_PORT' => '16495',
  'REDIRECT_QUERY_STRING' => 'cmd=login',
  'REDIRECT_URL' => '/login/',
  'GATEWAY_INTERFACE' => 'CGI/1.1',
  'SERVER_PROTOCOL' => 'HTTP/1.1',
  'REQUEST_METHOD' => 'POST',
  'QUERY_STRING' => 'cmd=login',
  'REQUEST_URI' => '/login/',
  'SCRIPT_NAME' => '/fitch/index.php',
  'PHP_SELF' => '/fitch/index.php',
  'REQUEST_TIME' => 1347486710,
  'argv' => 
  array (
    0 => 'cmd=login',
  ),
  'argc' => 1,
)

I am not sure if this is the cause of the problem. The website makes extensive use of Mod_rewrite - so maybe that is the cause...

Here is my .htaccess, just in case:

IndexIgnore *

<Limit GET POST>
order deny,allow
deny from all
allow from all
</Limit>
<Limit PUT DELETE>
order deny,allow
deny from all
</Limit>

ErrorDocument 404 /fitch/index.php?cmd=404error
RewriteEngine On

RewriteRule ^fitch/resources/ckfinder300/(.+)$ /fitch/resources/ckfinder/$1?maxWidth=300 [NC,L,QSA]

RewriteRule ^xd_receiver\.html$ /fitch/lib/facebook-platform/xd_receiver.html [NC,L,QSA]

RewriteCond %{HTTP_HOST} ^weatherbell\.com
RewriteRule ^(.*)$ http://www.weatherbell.com/$1 [R=301]

RewriteRule ^/?$ /fitch/index.php?cmd=homepage [NC,L,QSA]

#ADMIN
RewriteRule ^admin/?$ /fitch/index.php?cmd=admin [NC,L,QSA]
RewriteRule ^admin/logout/?$ /fitch/index.php?cmd=admin&logout=1 [NC,L,QSA]

#RewriteRule ^admin/users/?$ /fitch/index.php?cmd=admin_users [NC,L,QSA]
#RewriteRule ^admin/users/page/(\d+)/?$ /fitch/index.php?cmd=admin_users&page=$1 [NC,L,QSA]
#RewriteRule ^admin/users/page/(\d+)/keyword/([^\/]+)/?$ /fitch/index.php?cmd=admin_users&page=$1&keyword=$2 [NC,L,QSA]
RewriteRule ^admin/users/(admins|general)/?$ /fitch/index.php?cmd=admin_users&mode=$1 [NC,L,QSA]
RewriteRule ^admin/users/(admins|general)/page/(\d+)/?$ /fitch/index.php?cmd=admin_users&mode=$1&page=$2 [NC,L,QSA]
RewriteRule ^admin/users/(admins|general)/page/(\d+)/keyword/([^\/]+)/?$ /fitch/index.php?cmd=admin_users&mode=$1&page=$2&keyword=$3 [NC,L,QSA]
RewriteRule ^admin/users/export/?$ /fitch/index.php?cmd=admin_users_export [NC,L,QSA]

RewriteRule ^admin/users/(admins|general)/add/?$ /fitch/index.php?cmd=admin_users_edit&mode=$1 [NC,L,QSA]
RewriteRule ^admin/users/(admins|general)/edit/(\d+)/?$ /fitch/index.php?cmd=admin_users_edit&mode=$1&id=$2 [NC,L,QSA]
RewriteRule ^admin/users/(admins|general)/permissions/(\d+)/?$ /fitch/index.php?cmd=admin_users_permissions&mode=$1&id=$2 [NC,L,QSA]

RewriteRule ^admin/cms_content/?$ /fitch/index.php?cmd=admin_cms_content [NC,L,QSA]
RewriteRule ^admin/cms_content/add/?$ /fitch/index.php?cmd=admin_cms_content_edit [NC,L,QSA]
RewriteRule ^admin/cms_content/edit/(\d+)/?$ /fitch/index.php?cmd=admin_cms_content_edit&id=$1 [NC,L,QSA]

RewriteRule ^admin/site_vars/?$ /fitch/index.php?cmd=admin_site_vars [NC,L,QSA]

RewriteRule ^admin/seo_redirect_tool/?$ /fitch/index.php?cmd=admin_seo_redirect_tool [NC,L,QSA]
RewriteRule ^admin/seo_redirect_tool/add/?$ /fitch/index.php?cmd=admin_seo_redirect_tool_edit [NC,L,QSA]
RewriteRule ^admin/seo_redirect_tool/edit/(\d+)/?$ /fitch/index.php?cmd=admin_seo_redirect_tool_edit&id=$1 [NC,L,QSA]

RewriteRule ^admin/global_seo_controller/?$ /fitch/index.php?cmd=admin_global_seo_controller [NC,L,QSA]
RewriteRule ^admin/global_seo_controller/add/?$ /fitch/index.php?cmd=admin_global_seo_controller_edit [NC,L,QSA]
RewriteRule ^admin/global_seo_controller/edit/(\d+)/?$ /fitch/index.php?cmd=admin_global_seo_controller_edit&id=$1 [NC,L,QSA]

RewriteRule ^admin/cenzor/?$ /fitch/index.php?cmd=admin_cenzor [NC,L,QSA]
RewriteRule ^admin/cenzor/comments/?$ /fitch/index.php?cmd=admin_cenzor&comments=1 [NC,L,QSA]

RewriteRule ^admin/blogs/?$ /fitch/index.php?cmd=admin_blogs [NC,L,QSA]
RewriteRule ^admin/blogs/add/?$ /fitch/index.php?cmd=admin_blogs_edit [NC,L,QSA]
RewriteRule ^admin/blogs/edit/(\d+)/?$ /fitch/index.php?cmd=admin_blogs_edit&id=$1 [NC,L,QSA]
RewriteRule ^admin/blogs/entries/?$ /fitch/index.php?cmd=admin_blogs_entries [NC,L,QSA]
RewriteRule ^admin/blogs/entries/add/?$ /fitch/index.php?cmd=admin_blogs_entries_edit [NC,L,QSA]
RewriteRule ^admin/blogs/entries/edit/(\d+)/?$ /fitch/index.php?cmd=admin_blogs_entries_edit&id=$1 [NC,L,QSA]
RewriteRule ^admin/blogs/categories/?$ /fitch/index.php?cmd=admin_blogs_categories [NC,L,QSA]
RewriteRule ^admin/blogs/categories/add/?$ /fitch/index.php?cmd=admin_blogs_categories_edit [NC,L,QSA]
RewriteRule ^admin/blogs/categories/edit/(\d+)/?$ /fitch/index.php?cmd=admin_blogs_categories_edit&id=$1 [NC,L,QSA]

RewriteRule ^admin/comments/([^\/]+)/?$ /fitch/index.php?cmd=admin_comments&type=$1 [NC,L,QSA]
RewriteRule ^admin/comments/([^\/]+)/page/(\d+)/?$ /fitch/index.php?cmd=admin_comments&type=$1&page=$2 [NC,L,QSA]
RewriteRule ^admin/comments/([^\/]+)/edit/(\d+)/?$ /fitch/index.php?cmd=admin_comments_edit&type=$1&id=$2 [NC,L,QSA]
RewriteRule ^admin/comments/([^\/]+)/(\d+)/?$ /fitch/index.php?cmd=admin_comments&type=$1&id=$2 [NC,L,QSA]
RewriteRule ^admin/comments/([^\/]+)/(\d+)/page/(\d+)/?$ /fitch/index.php?cmd=admin_comments&type=$1&id=$2&page=$3 [NC,L,QSA]
RewriteRule ^admin/comments/([^\/]+)/(\d+)/edit/(\d+)/?$ /fitch/index.php?cmd=admin_comments_edit&type=$1&item_id=$2&id=$3 [NC,L,QSA]

RewriteRule ^admin/premium_categories/?$ /fitch/index.php?cmd=admin_premium_categories [NC,L,QSA]
RewriteRule ^admin/premium_categories/add/?$ /fitch/index.php?cmd=admin_premium_categories_edit [NC,L,QSA]
RewriteRule ^admin/premium_categories/edit/(\d+)/?$ /fitch/index.php?cmd=admin_premium_categories_edit&id=$1 [NC,L,QSA]

RewriteRule ^admin/premium_categories/edit/(\d+)/subcategories/?$ /fitch/index.php?cmd=admin_premium_categories&parent_id=$1 [NC,L,QSA]
RewriteRule ^admin/premium_categories/edit/(\d+)/subcategories/add/?$ /fitch/index.php?cmd=admin_premium_categories_edit&parent_id=$1 [NC,L,QSA]
RewriteRule ^admin/premium_categories/edit/(\d+)/subcategories/edit/(\d+)/?$ /fitch/index.php?cmd=admin_premium_categories_edit&parent_id=$1&id=$2 [NC,L,QSA]

RewriteRule ^admin/premium_cms_content/?$ /fitch/index.php?cmd=admin_premium_cms_content [NC,L,QSA]
RewriteRule ^admin/premium_cms_content/add/?$ /fitch/index.php?cmd=admin_premium_cms_content_edit [NC,L,QSA]
RewriteRule ^admin/premium_cms_content/edit/(\d+)/?$ /fitch/index.php?cmd=admin_premium_cms_content_edit&id=$1 [NC,L,QSA]

RewriteRule ^admin/videos/categories/?$ /fitch/index.php?cmd=admin_videos_categories [NC,L,QSA]
RewriteRule ^admin/videos/categories/add/?$ /fitch/index.php?cmd=admin_videos_categories_edit [NC,L,QSA]
RewriteRule ^admin/videos/categories/edit/(\d+)/?$ /fitch/index.php?cmd=admin_videos_categories_edit&id=$1 [NC,L,QSA]
RewriteRule ^admin/videos/?$ /fitch/index.php?cmd=admin_videos [NC,L,QSA]
RewriteRule ^admin/videos/add/?$ /fitch/index.php?cmd=admin_videos_edit [NC,L,QSA]
RewriteRule ^admin/videos/edit/(\d+)/?$ /fitch/index.php?cmd=admin_videos_edit&id=$1 [NC,L,QSA]
RewriteRule ^admin/videos/encoder_notification/?$ /fitch/index.php?cmd=admin_videos_encoder_notification [NC,L,QSA]

RewriteRule ^admin/videos_recipes/?$ /fitch/index.php?cmd=admin_videos_recipes [NC,L,QSA]
RewriteRule ^admin/videos_recipes/add/?$ /fitch/index.php?cmd=admin_videos_recipes_edit [NC,L,QSA]
RewriteRule ^admin/videos_recipes/(\d+)/?$ /fitch/index.php?cmd=admin_videos_recipes_edit&id=$1 [NC,L,QSA]

RewriteRule ^admin/premium_subscribers_mailer/?$ /fitch/index.php?cmd=admin_premium_subscribers_mailer [NC,L,QSA]

RewriteRule ^cron/check_subscriptions/?$ /fitch/index.php?cmd=cron_check_subscriptions [NC,L,QSA]
RewriteRule ^cron/check_trial_subscriptions/?$ /fitch/index.php?cmd=cron_check_trial_subscriptions [NC,L,QSA]
RewriteRule ^cron/premium_subscribers_mailer/?$ /fitch/index.php?cmd=cron_premium_subscribers_mailer [NC,L,QSA]

RewriteRule ^login/?$ /fitch/index.php?cmd=login [NC,L,QSA]
RewriteRule ^logout/?$ /fitch/index.php?cmd=login&logout=1 [NC,L,QSA]
RewriteRule ^forgot-password/?$ /fitch/index.php?cmd=forgot_password [NC,L,QSA]
RewriteRule ^register/?$ /fitch/index.php?cmd=register [NC,L,QSA]
RewriteRule ^register/payment/?$ /fitch/index.php?cmd=register_payment [NC,L,QSA]
RewriteRule ^account/edit/?$ /fitch/index.php?cmd=account_edit [NC,L,QSA]
RewriteRule ^refer-a-friend/?$ /fitch/index.php?cmd=referafriend [NC,L,QSA]

RewriteRule ^weather-maps/?$ /fitch/index.php?cmd=weather_maps [NC,L,QSA]
RewriteRule ^commercial/?$ /fitch/index.php?cmd=commercial [NC,L,QSA]
RewriteRule ^commercial/([\-a-zA-Z\d]+)/?$ /fitch/index.php?cmd=commercial_category&url=$1 [NC,L,QSA]
RewriteRule ^commercial/([\-a-zA-Z\d]+)/([\-a-zA-Z\d]+)/?$ /fitch/index.php?cmd=commercial_details&url=$1&item_url=$2 [NC,L,QSA]
RewriteRule ^premium/?$ /fitch/index.php?cmd=premium [NC,L,QSA]
RewriteRule ^premium/weather/?$ /fitch/index.php?cmd=weather [NC,L,QSA]

RewriteRule ^premium/([\-a-zA-Z\d]+)/?$ /fitch/index.php?cmd=blog&url=$1 [NC,L,QSA]
RewriteRule ^premium/([\-a-zA-Z\d]+)/page/(\d+)/?$ /fitch/index.php?cmd=blog&url=$1&page=$2 [NC,L,QSA]
RewriteRule ^premium/([\-a-zA-Z\d]+)/calendar/([\-\d]+)/?$ /fitch/index.php?cmd=blog&url=$1&calendar=$2 [NC,L,QSA]
RewriteRule ^premium/([\-a-zA-Z\d]+)/calendar/([\-\d]+)/page/(\d+)/?$ /fitch/index.php?cmd=blog&url=$1&calendar=$2&page=$3 [NC,L,QSA]
RewriteRule ^premium/([\-a-zA-Z\d]+)/([^\/]+)/?$ /fitch/index.php?cmd=blog_entry&blog_url=$1&entry_url=$2 [NC,L,QSA]

RewriteRule ^weather-news/?$ /fitch/index.php?cmd=blog&url=weather-news [NC,L,QSA]
RewriteRule ^weather-news/page/(\d+)/?$ /fitch/index.php?cmd=blog&url=weather-news&page=$1 [NC,L,QSA]
RewriteRule ^weather-news/calendar/([\-\d]+)/?$ /fitch/index.php?cmd=blog&url=weather-news&calendar=$1 [NC,L,QSA]
RewriteRule ^weather-news/calendar/([\-\d]+)/page/(\d+)/?$ /fitch/index.php?cmd=blog&url=weather-news&calendar=$1&page=$2 [NC,L,QSA]
RewriteRule ^weather-news/([^\/]+)/?$ /fitch/index.php?cmd=blog_entry&blog_url=weather-news&entry_url=$1 [NC,L,QSA]

RewriteRule ^weatherbell-press/?$ /fitch/index.php?cmd=blog&url=weatherbell-press [NC,L,QSA]
RewriteRule ^weatherbell-press/page/(\d+)/?$ /fitch/index.php?cmd=blog&url=weatherbell-press&page=$1 [NC,L,QSA]
RewriteRule ^weatherbell-press/calendar/([\-\d]+)/?$ /fitch/index.php?cmd=blog&url=weatherbell-press&calendar=$1 [NC,L,QSA]
RewriteRule ^weatherbell-press/calendar/([\-\d]+)/page/(\d+)/?$ /fitch/index.php?cmd=blog&url=weatherbell-press&calendar=$1&page=$2 [NC,L,QSA]
RewriteRule ^weatherbell-press/([^\/]+)/?$ /fitch/index.php?cmd=blog_entry&blog_url=weatherbell-press&entry_url=$1 [NC,L,QSA]

RewriteRule ^videos/?$ /fitch/index.php?cmd=videos [NC,L,QSA]
RewriteRule ^videos/([\-a-zA-Z\d]+)/?$ /fitch/index.php?cmd=videos_details&url=$1 [NC,L,QSA]

RewriteRule ^contact-us/?$ /fitch/index.php?cmd=contact [NC,L,QSA]
RewriteRule ^search/?$ /fitch/index.php?cmd=search [NC,L,QSA]

RewriteRule ^subscriptions_response/?$ /fitch/index.php?cmd=subscriptions_response [NC,L,QSA]
RewriteRule ^cron/subscriptions_date_updater/?$ /fitch/index.php?cmd=cron_subscriptions_date_updater [NC,L,QSA]

RewriteRule ^partner/rss/([\-a-zA-Z\d]+)/?$ /fitch/index.php?cmd=partner_rss&url=$1 [NC,L,QSA]

RewriteRule ^page-not-found/?$ /fitch/index.php?cmd=404error [NC,L,QSA]
RewriteRule ^([\w\/\-]+)/?$ /fitch/index.php?cmd=page&url_title=$1 [NC,L,QSA]

And for completeness, here is my httpd.conf.

I am new to PHP, Mod_rewrite, and server installation in general - so I would really appreciate some help!

Was it helpful?

Solution

This is the line:

$data = date("m/d/Y h:i:s") . " " . number_format(microtime(), 3) . "(" . $method . "): " . $str . "\n";

number_format expects a float, but microtime by default returns a string, what may, depending on error_reporting, result in a notice. This notice will be the output.

I would simply remove this:

number_format(microtime(), 3) 

... I don't think microseconds are necessary for debugging in any way.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top