derick          Fri Feb 15 04:12:59 2002 EDT

  Modified files:              
    /phpdoc/en/faq      using.xml 
  Log:
  - Adding headers already sent snippet to the faq
  
  
Index: phpdoc/en/faq/using.xml
diff -u phpdoc/en/faq/using.xml:1.13 phpdoc/en/faq/using.xml:1.14
--- phpdoc/en/faq/using.xml:1.13        Wed Dec 12 15:46:33 2001
+++ phpdoc/en/faq/using.xml     Fri Feb 15 04:12:58 2002
@@ -1,5 +1,5 @@
 <?xml version="1.0" encoding="iso-8859-1"?>
-<!-- $Revision: 1.13 $ -->
+<!-- $Revision: 1.14 $ -->
 <chapter id="faq.using">
   <title>Using PHP</title>
   <titleabbrev>Using PHP</titleabbrev>
@@ -110,6 +110,33 @@
       usually makes your life easier because you don't want that newline,
       but you'd have to create extremely long lines or otherwise make the
       raw page source unreadable to achieve that effect.
+     </para>
+    </answer>
+   </qandaentry>
+
+   <qandaentry id="faq.using.headers-sent">
+    <question>
+     <para>
+      I get the message 'Warning: Cannot send session cookie - headers already
+      sent...' or 'Cannot add header information - headers already sent...'.
+     </para>
+    </question>
+    <answer>
+     <para>
+      The functions <function>header</function>,
+      <function>set_cookie</function> and the session functions need to add
+      headers to the output stream. Headers can only be sent before all other
+      content.  function will do this if 
+      you are running PHP as an Apache module. So, the following bit
+      of code will show you all the request headers:
+      <programlisting role="php">
+<![CDATA[
+$headers = getallheaders();
+foreach ($headers as $name => $content) {
+    echo "headers[$name] = $content<br>\n";
+}
+]]>
+      </programlisting>
      </para>
     </answer>
    </qandaentry>


Reply via email to