I have a bizarre problem with using session_start() function. I have narrowed down my code to just two lines and uploaded the same to web server for testing. Here is my code :
<?php
session_start();
echo "hi";
?>
But the following messages are coming up onto the web browser:
Warning: session_start() [function.session-start]: Cannot send session cookie - headers already sent by (output started at /home/dchcov5r/public_html/demo/application/temp1.php:1) in /home/dchcov5r/public_html/demo/application/temp1.php on line 2
Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at /home/dchcov5r/public_html/demo/application/temp1.php:1) in /home/dchcov5r/public_html/demo/application/temp1.php on line 2
I am using Dreamweaver as my developer tool. This question may look similar to How to fix "Headers already sent" error in PHP but since I tried all or may be failed to efficiently implement the solutions provided therein, being a novice developer asking for pin-pointing the most probable cause because that thread shows so many answers.
Also, is it due to server settings in the web hosting or in php.ini file, because my code worked perfectly fine in localhost i.e. XAMPP.