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
start_session error
Re: start_session error
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
Best,
Jan
Kind regards,
<js />
My AppGini Blog:
https://appgini.bizzworxx.de/blog
You can help us helping you:
Please always put code fragments inside
AppGini 24.10 Revision 1579 + all AppGini Helper tools
<js />
My AppGini Blog:
https://appgini.bizzworxx.de/blog
You can help us helping you:
Please always put code fragments inside
[code]...[/code]
blocks for better readabilityAppGini 24.10 Revision 1579 + all AppGini Helper tools
Re: start_session error
Hi,
can you send the first few lines of your hooks/directorylinks.php. Are you including something in here?
can you send the first few lines of your hooks/directorylinks.php. Are you including something in here?
Any help offered comes with the best of intentions. Use it at your own risk. In any case, please make a backup of your existing environment before applying any changes.
Re: start_session error
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;
}
<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
Remove <html> and <body>. You dln't need them here. Then move the rest below the lasr bracket }
Best,
Jan
Best,
Jan
Kind regards,
<js />
My AppGini Blog:
https://appgini.bizzworxx.de/blog
You can help us helping you:
Please always put code fragments inside
AppGini 24.10 Revision 1579 + all AppGini Helper tools
<js />
My AppGini Blog:
https://appgini.bizzworxx.de/blog
You can help us helping you:
Please always put code fragments inside
[code]...[/code]
blocks for better readabilityAppGini 24.10 Revision 1579 + all AppGini Helper tools
Re: start_session error
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
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
Hi,
can you explain how you integerate the directorylinks.php in your app. From where are you calling the page?
can you explain how you integerate the directorylinks.php in your app. From where are you calling the page?
Any help offered comes with the best of intentions. Use it at your own risk. In any case, please make a backup of your existing environment before applying any changes.
Re: start_session error
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
);
<?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
1. Can you please confirm that your file hooks/directorylinks.php starts with...
...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
Code: Select all
<?php
define('PREPEND_PATH', '../');
...
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
Kind regards,
<js />
My AppGini Blog:
https://appgini.bizzworxx.de/blog
You can help us helping you:
Please always put code fragments inside
AppGini 24.10 Revision 1579 + all AppGini Helper tools
<js />
My AppGini Blog:
https://appgini.bizzworxx.de/blog
You can help us helping you:
Please always put code fragments inside
[code]...[/code]
blocks for better readabilityAppGini 24.10 Revision 1579 + all AppGini Helper tools
Re: start_session error
Jan,
The error referenced the same line since the file it referenced, lib.php, did not change.
Here is that file:
I did change the directorylinks.php file as you mentioned (except I added a line at the top). Here is that full file:
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");
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
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:
THANK YOU FOR YOUR HELP!!! I really appreciate it.
Mike
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");
?>
Mike
Re: start_session error
Great, Mike!
Glad that you've found a solution.
Best,
Jan
Glad that you've found a solution.
Best,
Jan
Kind regards,
<js />
My AppGini Blog:
https://appgini.bizzworxx.de/blog
You can help us helping you:
Please always put code fragments inside
AppGini 24.10 Revision 1579 + all AppGini Helper tools
<js />
My AppGini Blog:
https://appgini.bizzworxx.de/blog
You can help us helping you:
Please always put code fragments inside
[code]...[/code]
blocks for better readabilityAppGini 24.10 Revision 1579 + all AppGini Helper tools