I'm having trouble installing phpGedView 3.00.1 on a RedHat Linux 8.0 system with PHP 4.2.2. I followed the installation directions but keep getting an error message like "Warning: Cannot add header information - headers already sent by". There is also some weird stuff before the error. The entire error string is included at the end of this comment.
I tried to debug this myself but didn't get very far. It seems like the warning is due to an incorrect use of the header function in php. Various help boards about php suggest trying to remove weird characters to get rid of this warning so I ran dos2unix on the php files since I noticed they had ^M characters, but that did not help.
I could live with the warning if that was the only problem, but when I try and create a new GEDCOM file the code eventually gets stuck on a page with only the error message shown and nothing else.
Thanks in advance for any help.
-Emin
The error message is below:
0) //found individual increment counter { $hits = $matches[1][0]; $hits++; $l_fcontents = preg_replace("/(@$pid@) (\d+)/","$1 $hits",$l_fcontents); $fp=fopen($PGV_COUNTER_FILENAME,"r+"); fputs($fp,$l_fcontents); fclose($fp); } else //first view of individual { $fp=fopen($PGV_COUNTER_FILENAME,"r+"); fseek($fp,0,SEEK_END); fputs($fp,"\r\n@".$pid."@ 1"); fclose($fp); $hits=1; } $_SESSION[$PGV_INDI_COUNTER_NAME][$pid] = $hits; } } else //web site counter { // has user started a session on site yet if(isset($_SESSION[$PGV_COUNTER_NAME])) { $hits = $_SESSION[$PGV_COUNTER_NAME]; } else //new user so increment counter and save { $l_fcontents = file_get_contents($PGV_COUNTER_FILENAME); $ct = preg_match ("/^(\d+)/",$l_fcontents,$matches); if($ct) { $hits = $matches[0]; $hits++; $ct = preg_match("/^(\d+)@/",$l_fcontents,$matches); if($ct) //found missing return & newline $l_fcontents = preg_replace("/^(\d+)/","$hits\r\n",$l_fcontents); else //returns & newline exist $l_fcontents = preg_replace("/^(\d+)/","$hits",$l_fcontents); $fp=fopen($PGV_COUNTER_FILENAME,"r+"); fputs($fp,$l_fcontents); fclose($fp); } else $hits=0; $_SESSION[$PGV_COUNTER_NAME]=$hits; } } //replace the numbers with their images for($i=0;$i<10;$i++) $hits = str_replace("$i","pgv_counter","$hits"); $hits = str_replace('alt=""','alt="" border="0" height="12" width="10"',$hits); } ?>
Warning: Cannot add header information - headers already sent by (output started at /home/genealogy/public_html/hitcount.php:1) in /home/genealogy/public_html/functions_print.php on line 564
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Emin,
First of all the following is a quote from the readme:
"PhpGedView has been tested on installations of PHP 4.1.0 and greater, but for the best security
you should run PhpGedView on PHP version 4.3.x. It is highly reccommended that you upgrade to
PHP v4.3 or higher."
Did you edit or change any of the files at all?
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hello,
I'm having trouble installing phpGedView 3.00.1 on a RedHat Linux 8.0 system with PHP 4.2.2. I followed the installation directions but keep getting an error message like "Warning: Cannot add header information - headers already sent by". There is also some weird stuff before the error. The entire error string is included at the end of this comment.
I tried to debug this myself but didn't get very far. It seems like the warning is due to an incorrect use of the header function in php. Various help boards about php suggest trying to remove weird characters to get rid of this warning so I ran dos2unix on the php files since I noticed they had ^M characters, but that did not help.
I could live with the warning if that was the only problem, but when I try and create a new GEDCOM file the code eventually gets stuck on a page with only the error message shown and nothing else.
Thanks in advance for any help.
-Emin
The error message is below:
0) //found individual increment counter { $hits = $matches[1][0]; $hits++; $l_fcontents = preg_replace("/(@$pid@) (\d+)/","$1 $hits",$l_fcontents); $fp=fopen($PGV_COUNTER_FILENAME,"r+"); fputs($fp,$l_fcontents); fclose($fp); } else //first view of individual { $fp=fopen($PGV_COUNTER_FILENAME,"r+"); fseek($fp,0,SEEK_END); fputs($fp,"\r\n@".$pid."@ 1"); fclose($fp); $hits=1; } $_SESSION[$PGV_INDI_COUNTER_NAME][$pid] = $hits; } } else //web site counter { // has user started a session on site yet if(isset($_SESSION[$PGV_COUNTER_NAME])) { $hits = $_SESSION[$PGV_COUNTER_NAME]; } else //new user so increment counter and save { $l_fcontents = file_get_contents($PGV_COUNTER_FILENAME); $ct = preg_match ("/^(\d+)/",$l_fcontents,$matches); if($ct) { $hits = $matches[0]; $hits++; $ct = preg_match("/^(\d+)@/",$l_fcontents,$matches); if($ct) //found missing return & newline $l_fcontents = preg_replace("/^(\d+)/","$hits\r\n",$l_fcontents); else //returns & newline exist $l_fcontents = preg_replace("/^(\d+)/","$hits",$l_fcontents); $fp=fopen($PGV_COUNTER_FILENAME,"r+"); fputs($fp,$l_fcontents); fclose($fp); } else $hits=0; $_SESSION[$PGV_COUNTER_NAME]=$hits; } } //replace the numbers with their images for($i=0;$i<10;$i++) $hits = str_replace("$i","pgv_counter","$hits"); $hits = str_replace('alt=""','alt="" border="0" height="12" width="10"',$hits); } ?>
Warning: Cannot add header information - headers already sent by (output started at /home/genealogy/public_html/hitcount.php:1) in /home/genealogy/public_html/functions_print.php on line 564
Emin,
First of all the following is a quote from the readme:
"PhpGedView has been tested on installations of PHP 4.1.0 and greater, but for the best security
you should run PhpGedView on PHP version 4.3.x. It is highly reccommended that you upgrade to
PHP v4.3 or higher."
Did you edit or change any of the files at all?
The hitcount.php file uses short php tags. You should edit line 1 of hitcount.php and replace <? with <?php
Or you can download the updated file from the cvs here:
http://cvs.sourceforge.net/viewcvs.py/\*checkout*/phpgedview/phpGedView/hitcount.php?rev=1.6
--John