Panel does not work: "Cannot modify header information"

Sometimes http://localhost:8888/mywebsite/panel returns blank page, either from Chrome or Safari, either locally or remote on server.

I use github and work on my local version (using MAMP) from both my computer at home and my computer at work. Currently, my computer at work does not open the panel on both Safari and Chrome, both locally or remote.

From home instead, Chrome opens the login page locally, while Safari doesn’t. I had this issue before and I am not sure how I did fix it momentarily, but often it comes back.

I did activate Debug mode in config.php and when I try to load http://localhost:8888/mywebsite/panel it returns:

Warning: Cannot modify header information - headers already sent by (output started at /Users/gvocale/Desktop/mamp/mywebsite/site/config/config.php:1) in /Users/gvocale/Desktop/mamp/mywebsite/kirby/toolkit/lib/cookie.php on line 158

Warning: Cannot modify header information - headers already sent by (output started at /Users/gvocale/Desktop/mamp/mywebsite/site/config/config.php:1) in /Users/gvocale/Desktop/mamp/mywebsite/kirby/toolkit/lib/cookie.php on line 159

Warning: Cannot modify header information - headers already sent by (output started at /Users/gvocale/Desktop/mamp/mywebsite/site/config/config.php:1) in /Users/gvocale/Desktop/mamp/mywebsite/kirby/toolkit/lib/cookie.php on line 158

Warning: Cannot modify header information - headers already sent by (output started at /Users/gvocale/Desktop/mamp/mywebsite/site/config/config.php:1) in /Users/gvocale/Desktop/mamp/mywebsite/kirby/toolkit/lib/cookie.php on line 159

Warning: Cannot modify header information - headers already sent by (output started at /Users/gvocale/Desktop/mamp/mywebsite/site/config/config.php:1) in /Users/gvocale/Desktop/mamp/mywebsite/kirby/toolkit/lib/header.php on line 201

Warning: Cannot modify header information - headers already sent by (output started at /Users/gvocale/Desktop/mamp/mywebsite/site/config/config.php:1) in /Users/gvocale/Desktop/mamp/mywebsite/kirby/toolkit/lib/header.php on line 202

I then opened cookie.php and added on line 156:
session_save_path(sys_get_temp_dir());

Same I did with header.php and added on line 200:
session_save_path(sys_get_temp_dir());

This still didn’t fix my problem. I also erased everything in site/accounts and in site/cache…

Do you guys have any idea on what it could be?

Thanks

Could you please post your site/config/config.php? It seems like there is something in the first line of the file that shouldn’t be there.

Here it is. I am noticing there is a space before <?php. I’ve removed it, and all together upgraded to 2.2.1 and now it seem working well!

Thanks a lot for pointing me in the right direction and help me! I will let you know if the issue repeats itself. (I’ve removed the links in the followed copy and pasta because being a new user I can’t post more then 2 links in each post).

    <?php

/*

---------------------------------------
License Setup
---------------------------------------

Please add your license key, which you've received
via email after purchasing Kirby on http://getkirby.com/buy

It is not permitted to run a public website without a
valid license key. Please read the End User License Agreement
for more information: http://getkirby.com/license

*/

c::set('license', 'put your license key here');
c::set('debug', true);

/*

---------------------------------------
Kirby Configuration
---------------------------------------

By default you don't have to configure anything to
make Kirby work. For more fine-grained configuration
of the system, please check out http://getkirby.com/docs/advanced/options

*/

Yes, that was most definitely the issue. Great that it’s working again.

1 Like