PHP warning

session_start(): Cannot send session cookie - headers already sent by (output started at /home/kadampuz/public_html/index.php:4)

/home/kadampuz/public_html/protected/controllers/SiteController.php(98)

086             else
087                 $this->render('error', $error);
088         }
089     }
090 
091     /**
092      * Displays the contact page
093      */
094     public function actionContact()
095     {
096      $this->layout="subpage_for_section";
097         $model=new Contact;
098         session_start();
099 
100         if($_POST)
101         {
102             $url="https://www.google.com/recaptcha/api/siteverify";
103             $data['response'] = $_POST['g-recaptcha-response'];
104             $data['secret'] = "6Ldxd2YUAAAAAHEomsx3FGbTU0zhq7qYaniEjsHi";
105 
106 $handle = curl_init($url);
107 curl_setopt($handle, CURLOPT_POST, true);
108 curl_setopt($handle, CURLOPT_POSTFIELDS, $data);
109 curl_setopt($handle, CURLOPT_RETURNTRANSFER, 1);
110 $result = curl_exec($handle);

Stack Trace

#0
+
 /home/kadampuz/public_html/protected/controllers/SiteController.php(98): session_start()
093      */
094     public function actionContact()
095     {
096      $this->layout="subpage_for_section";
097         $model=new Contact;
098         session_start();
099 
100         if($_POST)
101         {
102             $url="https://www.google.com/recaptcha/api/siteverify";
103             $data['response'] = $_POST['g-recaptcha-response'];
#8
+
 /home/kadampuz/public_html/index.php(15): CApplication->run()
10 defined('YII_DEBUG') or define('YII_DEBUG',true);
11 // specify how many levels of call stack should be shown in each log message
12 defined('YII_TRACE_LEVEL') or define('YII_TRACE_LEVEL',3);
13 
14 require_once($yii);
15 Yii::createWebApplication($config)->run();
16 
17 
18 
19 
2022-05-19 21:58:21 Yii Framework/1.1.14