Session variables not saved


#1

I looked everywhere but could not find the solution for my problem.

If I do session_start(); in my index.php-file, then I get an error message (even twice):
Warning: session_start(): Cannot send session cookie - headers already sent by (output started at /storage/ssd1/948/1535948/public_html/Esperanto/Vortoj/WORK/Vortoj_Insert.php:1) in /storage/ssd1/948/1535948/public_html/Esperanto/Vortoj/WORK/Vortoj_Insert.php on line 51

Warning: session_start(): Cannot send session cache limiter - headers already sent (output started at /storage/ssd1/948/1535948/public_html/Esperanto/Vortoj/WORK/Vortoj_Insert.php:1) in /storage/ssd1/948/1535948/public_html/Esperanto/Vortoj/WORK/Vortoj_Insert.php on line 51

If I omit this statement, the session variables are not saved:
if (isset($_SESSION[‘counter’])) {
$_SESSION[‘counter’] = $_SESSION[‘counter’] + 1;
}
else {
$_SESSION[‘counter’] = 0;
}
echo "counter = " . $_SESSION[‘counter’] . ‘
’;

Who can help me?


#2

What is the link of your website?


#3

Is the session_start() at the top of your page?


#4

Add to your htaccess
php_flag output_buffering on


#5

YES, session_start() at the top of my page


#6

Make sure there is a tmp folder along with public_html folder