Cannot send session cache limiter headers already sent как исправить

от admin

Ошибка в session_start(): Cannot send session cache limiter

Warning: session_start() [function.session-start]: Cannot send session cache limiter — headers already sent (output started at /home/u22691/domains/pokess.u-gu.ru/public_html/game/fight.php:1) in /home/u22691/domains/pokess.u-gu.ru/public_html/game/fight.php on line 2

Видимо файл сохранен в кодировке utf-8 with bom, сохраняйте без bom.

Ну блин почти же по-русски написано link

Перед session_start() не должно быть никакого вывода на экран, даже пробела.

Перед сессией ничего не должно быть напсано, а так же стоит посмотреть кодировку. еще можно проверить файл php.ini

типичная ошибка следующая:

и вот тут после ?> стоит любой символ. Из-за этого PHP сразу выдаст header И причем, эту ошибку легко пропустить, если есть include, где такая штука произошла. Поэтому, лучше закрывающий ?> не писать, если у вас после него ничего нет.

Проблема может быть не столь очевидна, если ты программируешь классами. Например ты описываешь session_start() в главном файле с родительским классом. Там у тебя всё правильно написано: никаких выводов, никаких пробелов до начала сесии. Но при входе на сайт у тебя запускается файл потомок, то-есть почти всегда index.php . В тексте ошибки написана ссылка на ту строку, где объявлено начало сесии но проблема может быть и во всех файлах к которым ты подключаешь родительский класс с вызовом session_start() . Поэтому во всех файлах где есть присоединение например чтото вроде этого

Так вот до этих 2 строчек во всех файлах ничего не должно выводится. А вот после них — вполне возможно.

Проблема может быть и в следующем случае.

К примеру форма на php встроена в HTML. Работает, всё нормально. далее что либо добавляете в HTML . . . и приехали, вылетает сообщение. Ни один из вариантов вверху не помогает, ни с сохранением без ВОМ, ничего . . . это происходит из — за разницы в кодировке текста, который добавляете при помощи копипаст . . . Любые попытки сохранения итогового текста в UTF-8 либо в ANSI не приведут к нормальной работе скрипта.

Выход — рабочий вариант странички с формой на php открываете в текстовом редакторе и вносите изменения вручную. Затем просто сохраняете без функции сохранить как! Всё будет работать без ошибок. Извиняюсь за слишком подробный мануал.

How to Fix: Warning: session_start() [function.session-start]: Cannot send session cache limiter

Pete Boyd portrait

We recently came across this pesky problem and found these two articles very helpful.

Don’t save your UTF-8 files with BOM as it creates issues.

“Headers must be written before any data is sent to the client. Unicode files may include a Byte-Order Mark (BOM) to help distinguish the big endian and little endian byte order. Unfortunately, the BOM isn’t understood by PHP. Upon encountering the BOM, PHP assumes that it is dealing with data, by which time it’s too late to modify headers. Solution? Save the file in UTF-8 encoding without a BOM.”

“If file A or file B has UTF-8 encoding then you will get the error:

Warning: session_start() [function.session-start]: Cannot send session
cache limiter – headers already sent (output started at index.php:1) in
session.php on line 3

Using UTF-8 encoding WITHOUT BOM (Byte Order Mark) seems to fix the
problem.”

Related Posts

10 Things Your Web Developer Wishes You Knew

By Sergio Ramiez on January 31, 2023

How to Utilize and Print Lazy Loaded Images

By Ian on December 28, 2022

Signs You Need a New Web Host

By Sergio Ramiez on September 6, 2022

3 Website Errors You Can Fix Yourself

By David on August 30, 2022

How To Do a Hard Refresh

By Kyle on May 4, 2022

Related Services

Ready to Take Your Website to the Next Level? Great Ideas & Results Only a Phone Call Away

Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.

67 Responses to How to Fix: Warning: session_start() [function.session-start]: Cannot send session cache limiter

  1. viderbit
    6:21 am on August 4th, 2009

Omg thanks bro, i can’t believe that BOM can make browser to thing that receive header information instead BOM signature…

my site hosted live and i used the editor in cpanel to make one small change. nexst thing the error came up. thankfully we have google and people who post solutions. TIP: if you use the cpanel editor, use the code editor it works for php.
Regard

please ensure that these is nothing before session_start() command. Even a white space before the session_start() command will generate this warning message

Dear, u r right a white space created problem in my code and i rectified it, thank you very much.

Than you very much =) I almost give up on fixing this error, but thanks to you the error is now gone ��

Thanks bro. It was too painfully for me. But now it works fine just after eliminating the white space before php tag.

Many many thanks

Many many thanks, i s*ck with these error about 2 hours.

peteboyd i love you so much. problem solved, not only the file cousing the warning but all files should not be saved in UTF-8… ��

many many thanx!

can anybody fix it plz..i m fucked up but can fixed it ..get same erroe of session cant start..

Warning: session_start() [function.session-start]: Cannot send session cookie – headers already sent by (output started at D:Sitessingle57liladharmangewebrootsbseditprofile.php:1) in D:Sitessingle57liladharmangewebrootsbseditprofile.php on line 2
kindly help in above

Thanks….thanks…..thanks so much….I never knew about this BOM(Byte Order Mark) until now….my problem just got solved on the fly…..thanks so much for this tutorial…..citor(Nigeria)

i am using dremviewer and Netbeans as editior how can i save file without BOM (Byte Order Mark ) in UTF -8 charset

Warning: session_start() [function.session-start]: Cannot send session cache limiter – headers already sent (output started at /home/content/e/z/e/ezesite/html/clients/deepakchandran/satlineglobal.com/edit_profile.php:7) in /home/content/e/z/e/ezesite/html/clients/deepakchandran/satlineglobal.com/edit_profile.php on line310

You can also save the file as ANSI using the good-old Notepad. Open file with Notepad, File > Save-As > (bottom right) Encoding ANSI.

Warning: session_start() [function.session-start]: Cannot send session cache limiter – headers already sent (output started at C:\xampp\htdocs\b\index.php:9) in C:\xampp\htdocs\b\index.php on line 10
not login

Hello Kimaru, you need make sure resave your file and make sure there are no whitespace characters at the beginning.

Warning: session_start() [function.session-start]: Cannot send session cache limiter – headers already sent (output started at /home/pragmat2/public_html/MEProject/main.php:13) in /home/pragmat2/public_html/MEProject/main.php on line 13
Congra

Warning: session_start() [function.session-start]: Cannot send session cache limiter – headers already sent (output started at /home/pragmat2/public_html/MEProject/main.php:13) in /home/pragmat2/public_html/MEProject/main.php on line 13
pls help me and advance thks

i was also having same problem in joomla. There are 2 causes of this
1) Check the configuration file and see if there is a blank space before
2) Save your configuration file in ANSI and upload to server again

I resolved by issue with the 2nd case
Thanks to someone who helped me on joomla’s forum ��

i get this warning msg ……
Warning: session_start() [function.session-start]: Cannot send session cache limiter – headers already sent (output started at D:\PROJECT DATA\xampp\htdocs\css\admin.php:16) in D:\PROJECT DATA\xampp\htdocs\css\admin.php on line 124
help me….

Clear out any whitespace at the beginning of the file or end of the file. Also, try cutting/pasting into notepad and resaving the file.

hai i also getting same error

Warning: session_start() [function.session-start]: Cannot send session cache limiter – headers already sent (output started at /home/pragmat2/public_html/MEProject/main.php:4) in /home/pragmat2/public_html/MEProject/main.php
any body could pls help me

Glad I came across this so I could give it a try.

My scenario is that I am not worried about “white space” because I am using “ob_start()” to buffer the output. I have several scripts that I wrote based on the php same code.

When I moved my accounts to a new VPS server yesterday – all of a sudden the warning showed up on one of the websites. I couldn’t figure it out so squelched the output showing by putting * in front of session_start(); (*session_start();)

I didn’t like doing that and kept searching – only to find this solution and have it work. For some reason the warning was not happening on the other websites that used similar coding with object_start(). They must have been encoded without the BOM.

Awesome fix. �� love it.

Warning: session_start() [function.session-start]: Cannot send session cache limiter – headers already sent

Читать:
Линукс минт или убунту что лучше

Thank you! This fixed my problem!

Thank you . error fix �� .

I have save the file formate “UTF-8 encoding without a BOM”.

This options open notepad++ top menu “Encoding”

Thanks. That was it!

wow its work…, just by removing a white space befor <?PHP tag

Warning: session_start() [function.session-start]: Cannot send session cookie – headers already sent by (output started at C:\Inetpub\vhosts\gwaliorsearch.com\httpdocs\index.php:8) in C:\Inetpub\vhosts\gwaliorsearch.com\httpdocs\index.php on line 78

Thanks! I had some Google Analytics Code comment out above my php, and when I swapped them around to have the php on the top it fixed the error!

I got this warning message.and Can Please told me where to write session code or give me solution of it.
Warning: session_start() [function.session-start]: Cannot send session cache limiter – headers already sent (output started at /home/astutvsy/public_html/index.php:2) in /home/astutvsy/public_html/includes/header-index.php on line 2

This was exactly what was causing me trouble.
Thank you sooooooo much for your accurate solution.

I am getting the following error:
Warning: session_start() [function.session-start]: Cannot send session cache limiter – headers already sent (output started at C:\xampp\htdocs\Crime\login.php:6) in C:\xampp\htdocs\Crime\login.php on line 7

Warning: Cannot modify header information – headers already sent by (output started at C:\xampp\htdocs\Crime\login.php:6) in C:\xampp\htdocs\Crime\login.php on line 26

I have tried all above suggestions but not working. Below is my login.php code

<?php
session_start();
$UserName=$_POST['username'];
$Password=$_POST['password'];
$UserType=$_POST['cmbUser'];
if ($UserType=="Admin")
<
$con = mysql_connect("localhost","root");
mysql_select_db("cms", $con);
$sql = "select * from Admin_Tbl where Admin_Name='".$UserName."' and Admin_Password='".$Password."'";
$result = mysql_query($sql,$con);
$records = mysql_num_rows($result);
$row = mysql_fetch_array($result);
if ($records==0)
<
echo $records;
echo 'alert(“Wrong UserName or Password”);window.location=\’index.php\’;’;
>
else
<
header(“location:Admin\index.php”);
>
mysql_close($con);
>
else if($UserType==”Police”)
<
$con = mysql_connect(“localhost”,”root”);
mysql_select_db(“cms”, $con);
$sql = “select * from policestation_tbl
where UserName=’”.$UserName.”‘ and Password=’”.$Password.”‘”;
$result = mysql_query($sql,$con);
$records = mysql_num_rows($result);
$row = mysql_fetch_array($result);
if ($records==0)
<
echo $records;
echo ‘alert(“Wrong UserName or Password”);window.location=\’index.php\’;’;
>
else
<
$_SESSION[‘ID’]=$row[‘Station_Id’];
$_SESSION[‘Name’]=$row[‘Station_Name’];
header(“location:PoliceStation\index.php”);
>
mysql_close($con);
>
else
<
$con = mysql_connect(“localhost”,”root”);
mysql_select_db(“cms”, $con);
$sql = “select * from User_Tbl where UserName=’”.$UserName.”‘ and Password=’”.$Password.”‘”;
$result = mysql_query($sql,$con);
$records = mysql_num_rows($result);
$row = mysql_fetch_array($result);
if ($records==0)
<
echo $records;
echo ‘alert(“Wrong UserName or Password”);window.location=\’index.php\’;’;
>
else
<
$_SESSION[‘ID’]=$row[‘User_Id’];
$_SESSION[‘Name’]=$row[‘Name’];
header(“location:RegUser\index.php”);
>
mysql_close($con);
>
?>

Thanks for helpful replies …

i have same problem i am not coder and not know php filese please tell me which files need to edid from this error and how i can edit

Warning: session_start() [function.session-start]: Cannot send session cache limiter – headers already sent (output started at /home/adeel33/public_html/New Folder/admin/index.php:1) in /home/adeel33/public_html/New Folder/admin/library.php on line 16

Warning: session_start() [function.session-start]: Cannot send session cache limiter – headers already sent (output started at /home/adeel33/public_html/New Folder/admin/index.php:1) in /home/adeel33/public_html/New Folder/admin/library.php on line 16

Warning: Cannot modify header information – headers already sent by (output started at /home/adeel33/public_html/New Folder/admin/index.php:1) in /home/adeel33/public_html/New Folder/admin/includes/class_admin.php on line 60

Warning: Cannot modify header information – headers already sent by (output started at /home/adeel33/public_html/New Folder/admin/index.php:1) in /home/adeel33/public_html/New Folder/admin/includes/class_admin.php on line 61

Warning: Cannot modify header information – headers already sent by (output started at /home/adeel33/public_html/New Folder/admin/index.php:1) in /home/adeel33/public_html/New Folder/admin/includes/class_admin.php on line 62

Warning: Cannot modify header information – headers already sent by (output started at /home/adeel33/public_html/New Folder/admin/index.php:1) in /home/adeel33/public_html/New Folder/admin/sources/login.php on line 64

@asim Strip out white space. Also, try running it through notepad first.

urk! What a pain! My website didn’t have any issues until I added a login code, and then I got this error. But I’ve used the same login code across other sites without experiencing difficulties.

Fingers crossed, let’s hope I get this sorted out!

I am getting the following error when i am opening my website:-

Warning: session_start() [function.session-start]: Cannot send session cache limiter – headers already sent (output started at /home3/jatinjos/public_html/bengalblooms.com/index.php:10) in /home3/jatinjos/public_html/bengalblooms.com/vqmod/vqcache/vq2-system_startup.php on line 30
Warning: Cannot modify header information – headers already sent by (output started at /home3/jatinjos/public_html/bengalblooms.com/index.php:10) in /home3/jatinjos/public_html/bengalblooms.com/index.php on line 188

Anybody could help me please.
Thanks

thanks, Your right. now I already fixed my error.. �� ��

Below are the error which i am getting.on local pc its working but on server not working please help me

Warning: session_start(): Cannot send session cookie – headers already sent by (output started at /home3/hybreed/public_html/store/php/orderDetails.php:3) in /home3/hybreed/public_html/store/php/orderDetails.php on line 4

Warning: session_start(): Cannot send session cache limiter – headers already sent (output started at /home3/hybreed/public_html/store/php/orderDetails.php:3) in /home3/hybreed/public_html/store/php/orderDetails.php on line 4

Warning: Cannot modify header information – headers already sent by (output started at /home3/hybreed/public_html/store/php/orderDetails.php:3) in /home3/hybreed/public_html/store/php/orderDetails.php on line 160

I would recommend trying to get rid of any white space at the beginning of your file or possibly end of the file. Check around the cookie line. Perhaps even cut/paste from lines 1 – 4 into notepad, remove all spaces and paste back into the main php file.

Thank You very much..it helped – the white space thing didnt but saving the file as Utf – without BOM on note++ did the trick..Thank you…this only comes up on old

Warning: session_start(): cannot send session cache limiter – headers already sent

Warning: session_start(): cannot send session cache limiter – headers already sent – What’s wrong?

Have you ever had trouble with the session start of PHP? For example, when you started a session on a particular page, did you get the error: Warning: session_start(): cannot send session cache limiter – headers already sent before? Actually, the error means that some data has been already sent to the server and you are not able to send the header anymore.

If you are seeking some solutions to solve this trouble, we would like to show you some suggested methods that help other users successfully fix it. So, now, let’s start!

Warning: Session_Start(): Cannot Send Session Cache Limiter - Headers Already Sent

How to fix Warning: session_start(): cannot send session cache limiter – headers already sent

Here are some ways you should try one by one to find the most useful one.

  • Solution 1: Check out the code and make sure that the <?php is the first character. That means there is no space or tab before.
  • Solution 2: Put the code <?php session_start(); ?>above all other code.
  • Solution 3: Change the encoding of the document from UTF-8 to ANSI. Or you can use UTF-8 encoding without BOM (Byte Oder Mark) by ensuring that you don’t use notepad.exe to edit or save the files since it will insert UTF-8 BOM.

Conclusion

All in all, we have already shared with you the three methods to fix this common error: Warning: session_start(): cannot send session cache limiter – headers already sent. Therefore, we hope that it will be useful for you. If you have more ideas to address this trouble, don’t hesitate to let us know by leaving your comment below.

Furthermore, if you are using WordPress or Joomla and want to change the appearance of your site, let’s have a look at the collection of Free WordPress Themes as well as Joomla 4 Templates here. Thanks for your attention and have a wonderful day.

Fixing Warning: session_start(): Cannot send session cache limiter – headers already sent (output started at /home/xxxxx/public_html/wp-content/plugins/pdf-viewer-for-wordpress/web/viewer-shortcode.php:3)

Fixing-Warning-session_start__-Cannot-send-session-cache-limiter-–-headers-already-sent

We received this issue from a few users. So, We did a workaround and made a way to fix it.

Some servers add spaces to uploaded files somehow, for encoding type I think but not totally sure. However, due to extra spaces, there’s a warning message displays on top of Viewer.

Warning: session_start(): Cannot send session cache limiter – headers already sent (output started at /home/xxxxx/public_html/wp-content/plugins/pdf-viewer-for-wordpress/web/viewer-shortcode.php:3)

And here’s how you can fix it:
1. Login to your wp-admin with admin user & password.
1. Install & activate Wpide plugin from Plugins->Add New
3. open plugins/pdf-viewer-for-wordpress/web/viewer-shortcode.php
4. replace first few lines with the following code:

ob_start();
session_start();
$scriptPath = dirname(__FILE__);
$path = realpath($scriptPath . ‘/./’);
$filepath = explode(«wp-content»,$path);
define(‘WP_USE_THEMES’, false);
require(».$filepath[fusion_builder_container hundred_percent=»yes» overflow=»visible»][fusion_builder_row][fusion_builder_column type=»1_1″ background_position=»left top» background_color=»» border_size=»» border_color=»» border_style=»solid» spacing=»yes» background_image=»» background_repeat=»no-repeat» padding=»» margin_top=»0px» margin_bottom=»0px» animation_type=»» animation_speed=»0.3″ animation_direction=»left» hide_on_mobile=»no» center_content=»no» min_height=»none»][0].’/wp-blog-header.php’);

***** For some cases, if you still having the issue after replacing lines, please try removing first two lines. that are :

ob_start();
session_start();

First few lines should look like this.

First few lines should look like this.

5. Do the same for plugins/pdf-viewer-for-wordpress/web/viewer.php
6. make sure there is no extra space on the first line before or after

7. Save the Files.

The error should be gone now…

Please Contact Support if you still having the issue or need our help to get it done.

Похожие статьи