Page 1 of 1
start_session error
Posted: 2019-05-02 15:08
by MikeB
I have an application running in XAMPP. When uploaded to my website, I get the following error when I go to a custom page:
Warning: session_start(): Cannot send session cache limiter - headers already sent (output started at /home/yxmljtnt/public_html/mikeberger.com/hooks/directorylinks.php:1) in /home/yxmljtnt/public_html/mikeberger.com/lib.php on line 83
Is this information sufficient to figure out what the issue is?
Mike Berger
Re: start_session error
Posted: 2019-05-02 15:35
by jsetzer
I once had such an error when I was debugging some variables using var_dump($xyz) too early in my code. After I have moved my debug output into one of the hook functions everything was fine.
Best,
Jan
Re: start_session error
Posted: 2019-05-02 17:50
by pbottcher
Hi,
can you send the first few lines of your hooks/directorylinks.php. Are you including something in here?
Re: start_session error
Posted: 2019-05-02 21:08
by MikeB
The first few lines of directorylinks.php are:
<html>
<br>
<br>
<h2 align="center">Lake Forest Direcotry</h2>
<h3>Chose to generate directory pages with last names beginning with the following letters:</h3>
<body>
<?php
define('PREPEND_PATH', '../');
$hooks_dir = dirname(__FILE__);
include("$hooks_dir/../defaultLang.php");
include("$hooks_dir/../language.php");
include("$hooks_dir/../lib.php");
include_once("$hooks_dir/../header.php");
/* grant access to the groups 'Admins' and 'Data entry' */
$mi = getMemberInfo();
if(!in_array($mi['group'], array('Admins', 'Data entry'))){
echo "Access denied";
exit;
}
Re: start_session error
Posted: 2019-05-03 03:57
by jsetzer
Remove <html> and <body>. You dln't need them here. Then move the rest below the lasr bracket }
Best,
Jan
Re: start_session error
Posted: 2019-05-03 16:13
by MikeB
Thanks, Jan. I did that - the links work, but I still see the error:
Warning: session_start(): Cannot send session cache limiter - headers already sent (output started at /home/yxmljtnt/public_html/mikeberger.com/hooks/directorylinks.php:1) in /home/yxmljtnt/public_html/mikeberger.com/lib.php on line 83
I do not get the error on my computer using XAMPP
Mike
Re: start_session error
Posted: 2019-05-05 08:18
by pbottcher
Hi,
can you explain how you integerate the directorylinks.php in your app. From where are you calling the page?
Re: start_session error
Posted: 2019-05-05 11:11
by MikeB
I use the file links-home.php in th ehooks directory to get to directorylinks.php. The file consists of the following:
<?php
/*
* You can add custom links in the home page by appending them here ...
* The format for each link is:
*/
$homeLinks[] = array(
'url' => 'hooks/directorylinks.php',
'title' => 'Create Directory by Last Name',
'description' => 'Diretory generation',
'groups' => array('admins', 'Data entry'), // groups allowed to see this link, use '*' if you want to show the link to all groups
'icon' => 'images/folder.ico', // optional icon to use with the link
);
Re: start_session error
Posted: 2019-05-05 11:24
by jsetzer
1. Can you please confirm that your file
hooks/directorylinks.php starts with...
Code: Select all
<?php
define('PREPEND_PATH', '../');
...
...now.
2. Your previous error message says "... in line 83". After your recent changes there should be a different line number. Can you please check that.
3. Is it possible to see the whole file? Can you paste it here or send it via PM?
Best,
Jan
Re: start_session error
Posted: 2019-05-05 17:15
by MikeB
Jan,
The error referenced the same line since the file it referenced, lib.php, did not change.
Here is that file:
Code: Select all
<?php
// This script and data application were generated by AppGini 5.74
// Download AppGini for free from https://bigprof.com/appgini/download/
error_reporting(E_ERROR | E_WARNING | E_PARSE);
if(!defined('datalist_db_encoding')) define('datalist_db_encoding', 'UTF-8');
if(!defined('maxSortBy')) define('maxSortBy', 4);
if(!defined('empty_lookup_value')) define('empty_lookup_value', '{empty_value}');
if(function_exists('date_default_timezone_set')) @date_default_timezone_set('America/Chicago');
if(function_exists('set_magic_quotes_runtime')) @set_magic_quotes_runtime(0);
$GLOBALS['filter_operators'] = array(
'equal-to' => '<=>',
'not-equal-to' => '!=',
'greater-than' => '>',
'greater-than-or-equal-to' => '>=',
'less-than' => '<',
'less-than-or-equal-to' => '<=',
'like' => 'like',
'not-like' => 'not like',
'is-empty' => 'isEmpty',
'is-not-empty' => 'isNotEmpty'
);
$currDir = dirname(__FILE__);
include("$currDir/settings-manager.php");
detect_config();
migrate_config();
include("$currDir/config.php");
include("$currDir/db.php");
include("$currDir/ci_input.php");
include("$currDir/datalist.php");
include("$currDir/incCommon.php");
include("$currDir/admin/incFunctions.php");
// detecting classes not included above
@spl_autoload_register(function($class) {
$app_dir = dirname(__FILE__);
@include("{$app_dir}/resources/lib/{$class}.php");
});
ob_start();
/* trim $_POST, $_GET, $_REQUEST */
if(count($_POST)) $_POST = array_trim($_POST);
if(count($_GET)) $_GET = array_trim($_GET);
if(count($_REQUEST)) $_REQUEST = array_trim($_REQUEST);
// include global hook functions
@include_once("$currDir/hooks/__global.php");
// check sessions config
$noPathCheck = true;
$arrPath = explode(';', ini_get('session.save_path'));
$save_path = $arrPath[count($arrPath)-1];
if(!$noPathCheck && !is_dir($save_path)){
?>
<center>
<div class="alert alert-danger">
Your site is not configured to support sessions correctly. Please edit your php.ini file and change the value of <i>session.save_path</i> to a valid path.
</div>
</center>
<?php
exit;
}
if(session_id()){ session_write_close(); }
$configured_save_handler = @ini_get('session.save_handler');
if($configured_save_handler != 'memcache' && $configured_save_handler != 'memcached')
@ini_set('session.save_handler', 'files');
@ini_set('session.serialize_handler', 'php');
@ini_set('session.use_cookies', '1');
@ini_set('session.use_only_cookies', '1');
@ini_set('session.cookie_httponly', '1');
@ini_set('session.use_strict_mode', '1');
@session_cache_expire(2);
@session_cache_limiter($_SERVER['REQUEST_METHOD'] == 'POST' ? 'private' : 'nocache');
@session_name('Lake_Forest_Residents');
session_start();
// check if membership system exists
setupMembership();
// silently apply db changes, if any
@include_once("$currDir/updateDB.php");
// do we have a login request?
logInMember();
// convert expanded sorting variables, if provided, to SortField and SortDirection
$postedOrderBy = array();
for($i = 0; $i < maxSortBy; $i++){
if(isset($_REQUEST["OrderByField$i"])){
$sd = ($_REQUEST["OrderDir$i"] == 'desc' ? 'desc' : 'asc');
if($sfi = intval($_REQUEST["OrderByField$i"])){
$postedOrderBy[] = array($sfi => $sd);
}
}
}
if(count($postedOrderBy)){
$_REQUEST['SortField'] = '';
$_REQUEST['SortDirection'] = '';
foreach($postedOrderBy as $obi){
$sfi = ''; $sd = '';
foreach($obi as $sfi => $sd);
$_REQUEST['SortField'] .= "$sfi $sd,";
}
$_REQUEST['SortField'] = substr($_REQUEST['SortField'], 0, -2 - strlen($sd));
$_REQUEST['SortDirection'] = $sd;
}elseif($_REQUEST['apply_sorting']){
/* no sorting and came from filters page .. so clear sorting */
$_REQUEST['SortField'] = $_REQUEST['SortDirection'] = '';
}
// include nav menu links
@include_once("$currDir/hooks/links-navmenu.php");
I did change the directorylinks.php file as you mentioned (except I added a line at the top). Here is that full file:
Code: Select all
<?php
echo "<br>";
echo "<br>";
echo "<h2 align='center'>Lake Forest Direcotry</h2>";
echo "<h3>Choose to generate directory pages with last names beginning with the following letters:</h3>";
define('PREPEND_PATH', '../');
$hooks_dir = dirname(__FILE__);
include("$hooks_dir/../defaultLang.php");
include("$hooks_dir/../language.php");
include("$hooks_dir/../lib.php");
include_once("$hooks_dir/../header.php");
/* grant access to the groups 'Admins' and 'Data entry' */
$mi = getMemberInfo();
if(!in_array($mi['group'], array('Admins', 'Data entry'))){
echo "Access denied";
exit;
}
/* * You can add custom links to the navigation menu by appending them here ...
* The format for each link is:
$navLinks[] = array(
'url' => 'hooks/directory.php',
'title' => 'Directory Generation',
'groups' => array('admins', 'Data entry'), // groups allowed to see this link, use '*' if you want to show the link to all groups
'icon' => 'images/folder.ico',
'table_group' => 0, // optional index of table group, default is 0
);
echo "<H2>TEST TEXT"</H2><br>;
echo '<a href="http://localhost/lakeforestresidents/hooks/lfpages/directory_ab.php">Last names begging with A and B<img border="0" src="AB.png" width="127" height="52"></a><br>';
echo '<a href="http://localhost/lakeforestresidents/hooks/lfpages/directory_cd.php">Last names begging with C and D</a><br>';
echo '<a href="http://localhost/lakeforestresidents/hooks/lfpages/directory_ef.php">Last names begging with E and F</a><br>';
echo '<a href="http://localhost/lakeforestresidents/hooks/lfpages/directory_ghi.php">Last names begging with G, H and I</a><br>';
echo '<a href="http://localhost/lakeforestresidents/hooks/lfpages/directory_jkl.php">Last names begging with J, K, and L</a><br>';
echo '<a href="http://localhost/lakeforestresidents/hooks/lfpages/directory_mno.php">Last names begging with M, N, and O</a><br>';
echo '<a href="http://localhost/lakeforestresidents/hooks/lfpages/directory_pqr.php">Last names begging with P, Q, and R</a><br>';
echo '<a href="http://localhost/lakeforestresidents/hooks/lfpages/directory_st.php">Last names begging with S and T</a><br>';
echo '<a href="http://localhost/lakeforestresidents/hooks/lfpages/directory_uvw.php">Last names begging with U, V, and W</a><br>';
echo '<a href="http://localhost/lakeforestresidents/hooks/lfpages/directory_xyz.php">Last names begging with X, Y, and Z</a><br>';
*/
/* $navLinks[] = array(
'url' => 'hooks/directory.php',
'title' => 'Directory Generation',
'groups' => array('admins', 'Data entry'), // groups allowed to see this link, use '*' if you want to show the link to all groups
'icon' => 'images/folder.ico',
'table_group' => 0, // optional index of table group, default is 0
);
http://www.mikeberger.com/hooks/directorylinks.php
*/
echo '<a href="http://www.mikeberger.com/hooks/lfpages/directory_ab.php"><img border="0" src="..\images\AB.png" width="127" height="52"></a><br>';
echo '<a href="http://www.mikeberger.com/hooks/lfpages/directory_cd.php"><img border="0" src="..\images\CD.png" width="127" height="52"></a><br>';
echo '<a href="http://www.mikeberger.com/hooks/lfpages/directory_ef.php"><img border="0" src="..\images\EF.png" width="127" height="52"></a><br>';
echo '<a href="http://www.mikeberger.com/hooks/lfpages/directory_ghi.php"><img border="0" src="..\images\GHI.png" width="127" height="52"></a><br>';
echo '<a href="http://www.mikeberger.com/hooks/lfpages/directory_jkl.php"><img border="0" src="..\images\JKL.png" width="127" height="52"></a><br>';
echo '<a href="http://www.mikeberger.com/hooks/lfpages/directory_mno.php"><img border="0" src="..\images\MNO.png" width="127" height="52"></a><br>';
echo '<a href="http://www.mikeberger.com/hooks/lfpages/directory_pqr.php"><img border="0" src="..\images\PQR.png" width="127" height="52"></a><br>';
echo '<a href="http://www.mikeberger.com/hooks/lfpages/directory_st.php"><img border="0" src="..\images\ST.png" width="127" height="52"></a><br>';
echo '<a href="http://www.mikeberger.com/hooks/lfpages/directory_uvw.php"><img border="0" src="..\images\UVW.png" width="127" height="52"></a><br>';
echo '<a href="http://www.mikeberger.com/hooks/lfpages/directory_xyz.php"><img border="0" src="..\images\XYZ.png" width="127" height="52"></a><br>';
include_once("$hooks_dir/../footer.php");
?>
Re: start_session error
Posted: 2019-05-05 17:23
by MikeB
Jan,
It works now!
Ignore my last post. I modified the directorylinks.php the way you told me and the error is gone! Putting anything in front of the lines you said should come first caused the error.
See the file now:
Code: Select all
<?php
define('PREPEND_PATH', '../');
$hooks_dir = dirname(__FILE__);
include("$hooks_dir/../defaultLang.php");
include("$hooks_dir/../language.php");
include("$hooks_dir/../lib.php");
include_once("$hooks_dir/../header.php");
/* grant access to the groups 'Admins' and 'Data entry' */
$mi = getMemberInfo();
if(!in_array($mi['group'], array('Admins', 'Data entry'))){
echo "Access denied";
exit;
}
echo "<br>";
echo "<br>";
echo "<h2 align='center'>Lake Forest Direcotry</h2>";
echo "<h3>Choose to generate directory pages with last names beginning with the following letters:</h3>";
/* * You can add custom links to the navigation menu by appending them here ...
* The format for each link is:
$navLinks[] = array(
'url' => 'hooks/directory.php',
'title' => 'Directory Generation',
'groups' => array('admins', 'Data entry'), // groups allowed to see this link, use '*' if you want to show the link to all groups
'icon' => 'images/folder.ico',
'table_group' => 0, // optional index of table group, default is 0
);
echo "<H2>TEST TEXT"</H2><br>;
echo '<a href="http://localhost/lakeforestresidents/hooks/lfpages/directory_ab.php">Last names begging with A and B<img border="0" src="AB.png" width="127" height="52"></a><br>';
echo '<a href="http://localhost/lakeforestresidents/hooks/lfpages/directory_cd.php">Last names begging with C and D</a><br>';
echo '<a href="http://localhost/lakeforestresidents/hooks/lfpages/directory_ef.php">Last names begging with E and F</a><br>';
echo '<a href="http://localhost/lakeforestresidents/hooks/lfpages/directory_ghi.php">Last names begging with G, H and I</a><br>';
echo '<a href="http://localhost/lakeforestresidents/hooks/lfpages/directory_jkl.php">Last names begging with J, K, and L</a><br>';
echo '<a href="http://localhost/lakeforestresidents/hooks/lfpages/directory_mno.php">Last names begging with M, N, and O</a><br>';
echo '<a href="http://localhost/lakeforestresidents/hooks/lfpages/directory_pqr.php">Last names begging with P, Q, and R</a><br>';
echo '<a href="http://localhost/lakeforestresidents/hooks/lfpages/directory_st.php">Last names begging with S and T</a><br>';
echo '<a href="http://localhost/lakeforestresidents/hooks/lfpages/directory_uvw.php">Last names begging with U, V, and W</a><br>';
echo '<a href="http://localhost/lakeforestresidents/hooks/lfpages/directory_xyz.php">Last names begging with X, Y, and Z</a><br>';
*/
/* $navLinks[] = array(
'url' => 'hooks/directory.php',
'title' => 'Directory Generation',
'groups' => array('admins', 'Data entry'), // groups allowed to see this link, use '*' if you want to show the link to all groups
'icon' => 'images/folder.ico',
'table_group' => 0, // optional index of table group, default is 0
);
http://www.mikeberger.com/hooks/directorylinks.php
*/
echo '<a href="http://www.mikeberger.com/hooks/lfpages/directory_ab.php"><img border="0" src="..\images\AB.png" width="127" height="52"></a><br>';
echo '<a href="http://www.mikeberger.com/hooks/lfpages/directory_cd.php"><img border="0" src="..\images\CD.png" width="127" height="52"></a><br>';
echo '<a href="http://www.mikeberger.com/hooks/lfpages/directory_ef.php"><img border="0" src="..\images\EF.png" width="127" height="52"></a><br>';
echo '<a href="http://www.mikeberger.com/hooks/lfpages/directory_ghi.php"><img border="0" src="..\images\GHI.png" width="127" height="52"></a><br>';
echo '<a href="http://www.mikeberger.com/hooks/lfpages/directory_jkl.php"><img border="0" src="..\images\JKL.png" width="127" height="52"></a><br>';
echo '<a href="http://www.mikeberger.com/hooks/lfpages/directory_mno.php"><img border="0" src="..\images\MNO.png" width="127" height="52"></a><br>';
echo '<a href="http://www.mikeberger.com/hooks/lfpages/directory_pqr.php"><img border="0" src="..\images\PQR.png" width="127" height="52"></a><br>';
echo '<a href="http://www.mikeberger.com/hooks/lfpages/directory_st.php"><img border="0" src="..\images\ST.png" width="127" height="52"></a><br>';
echo '<a href="http://www.mikeberger.com/hooks/lfpages/directory_uvw.php"><img border="0" src="..\images\UVW.png" width="127" height="52"></a><br>';
echo '<a href="http://www.mikeberger.com/hooks/lfpages/directory_xyz.php"><img border="0" src="..\images\XYZ.png" width="127" height="52"></a><br>';
include_once("$hooks_dir/../footer.php");
?>
THANK YOU FOR YOUR HELP!!! I really appreciate it.
Mike
Re: start_session error
Posted: 2019-05-05 17:49
by jsetzer
Great, Mike!
Glad that you've found a solution.
Best,
Jan