Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 724619
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T06:14:35+00:00 2026-05-14T06:14:35+00:00

i need to set cookies in my page, but it returns Warning: Cannot modify

  • 0

i need to set cookies in my page, but it returns

Warning: Cannot modify header information - headers already sent by (output started at /home1/bsam/public_html/24kadr/index.php:1) in /home1/bsam/public_html/24kadr/basic_login.php  on line 35

on line 1 i have

include 'basic_login.php'; 

but even if i remoove include, ir returns the same warning on session_start, or mysql_connect.
so i think these all functions use header when calling, but what can i do? at least i need to connect to database, and just after it i need to use setcookie().
so what can i do?
thanks

update the first lines of index.php

<?include 'basic_login.php';include 'settings.php';?>
<!DOCTYPE html
PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" 
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html>
<head>
...........

in basic_login.php it starts

<?
session_start();
include 'connect.php';
ini_set("session.bug_compat_42",1);
ini_set("session.bug_compat_warn",0);

……………………………………

setcookie("cookname", $_SESSION['username'], time()+60*60*24*30, "/");
setcookie("cookpass", $_SESSION['password'], time()+60*60*24*30, "/");

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-14T06:14:36+00:00Added an answer on May 14, 2026 at 6:14 am

    You most likely have white space in /24kadr/index.php before the opening <?php. Remove it and it should be fine.

    If there is no white space, maybe your PHP file was saved with a Byte Order Mark (BOM). In that case, have your editor save the file without it.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm a begginer in cookies and stuff like that. I need to set a
I need to set/get the cookies stored at first.example while browsing second.example , I
I need to set a cookie with javascript which I'm doing this with the
Need set zoom for camera preview...
I need set a cultureinfo different of others in a currency field. Metadata: [Display(ResourceType
I need Set collection, where its items will be identified by items class. Something
Need to set some attributes of button. For example Checked. I guess it is
I need to set query in my auth script, where in WHERE clause I
I need to set the color of the font every time I add text
I need to set custom alarm tone in my App. Could anyone please just

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.