|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #32375 $_POST, $HTTP_RAW_POST_DATA not set
Submitted: 2005-03-19 19:50 UTC Modified: 2005-04-02 00:40 UTC
From: jnavratil at houston dot rr dot com Assigned:
Status: Closed Package: Apache2 related
PHP Version: 5CVS-2005-03-19 (dev) OS: SuSE Linux 9.1
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
Block user comment
Status: Assign to:
Bug Type:
From: jnavratil at houston dot rr dot com
New email:
PHP Version: OS:


 [2005-03-19 19:50 UTC] jnavratil at houston dot rr dot com
This bug is similar to, but not quite the same as bug #31417.

Running Suse Linux 9.1, Apache 2.0.53 and latest snapshot of PHP, I do not have $_POST variables being set.  $_GET superglobal seems to be fine.  Additionally, even though phpinfo() shows 'always_populate_raw_post_data' on, $HTTP_RAW_POST_DATA is not defined.

PHP configure line is:

./configure --prefix=/usr/local/php5 \
       --with-apxs2=/usr/local/apache2/bin/apxs \
       --with-libxml-dir=/usr/local/lib --with-zlib \
       --with-zlib-dir=/usr/local/lib \
       --with-mysql=/usr \
       --with-gd \
         --with-jpeg-dir=/usr/lib --with-png-dir=/usr/lib \
	 --enable-gd-native-ttf --with-freetype-dir=/usr/lib \
       --enable-soap --enable-sockets \
       --with-jpeg-dir=/usr --enable-exif

Reproduce code:
echo '<!-- $_POST:'.print_r($_POST, TRUE)." -->\n";
echo '<!-- $_GET:'.print_r($_GET, TRUE)." -->\n";
echo '<!-- $_REQUEST:'.print_r($_REQUEST, TRUE)." -->\n";
// Next line generates 'Undefined variable: HTTP_RAW_POST_DATA'
// even though phpinfo shows always_populate_raw_post_data On
// echo '<!-- raw post data:'.$HTTP_RAW_POST_DATA." -->\n";
if (!isset($_POST['tableName']) or trim($_POST['tableName']) == '') {
    <form method="post" action="post.php">
      <p> Table Name:&nbsp;<input type="text" name="tableName" /> </p>
      <input type="submit" value="Submit" />
<?php } else { ?>
    <p> You entered <?php echo $_POST['tableName']; ?> </p>
<?php } ?>

Expected result:
I expect the code to present a form to input a string, then display the string when the form is submitted.  I expect to see comments in the page source displaying the $_POST, $_GET and $_REQUEST arrays.

Actual result:
The $_POST variables are not set when the form is submitted.  If I attach variables to the URL (i.e. post.php?key=value), I see variables in the $_GET and $_REQUEST superglobals.  Comments generated in the page source indicate that $_POST is an array, but it is empty.


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2005-03-20 23:06 UTC]
I can not reproduce this. Please give more information about your setup: How did you configure PHP in httpd.conf? What changes did you make into php.ini? (is the right php.ini loaded?) 

And DO NOT paste full php.ini here! Make a unified diff against php.ini-dist (or if you used php.ini-recommeded as basis, against that one)

 [2005-03-23 21:21 UTC] jnavratil at houston dot rr dot com
Greetings, and thanks!  I am travelling this week, so please forgive the reply latency.

Note that I am running a compiled Apache 2.0.53, not a standard SuSE 9.1 distro and am using default file placements.  I verified by using phpinfo() that the expected php.ini is being loaded and the build date of is also correct.  The only change to httpd.conf for php5 was to add the..

LoadModule php5_module modules/

My php.ini is based on a slightly older php.ini-recommended, but is diffed against the 3/19 snapshot of same.  This server will be the production server, but errors are turned on, for the moment, to facilitate finding installation, configuration and porting problems.  The differences are:

--- php.ini-recommended 2005-02-28 19:30:02.000000000 -0600
+++ /usr/local/php5/lib/php.ini 2005-03-19 11:48:54.000000000 -0600
@@ -272,7 +272,7 @@
 disable_classes =

 ; Colors for Syntax Highlighting mode.  Anything that's acceptable in
-; <span style="color: ???????"> would work.
+; <font color="??????"> would work.
 ;highlight.string  = #DD0000
 ;highlight.comment = #FF9900
 ;highlight.keyword = #007700
@@ -280,10 +280,6 @@
 ;highlight.default = #0000BB
 ;highlight.html    = #000000

-; If enabled, the request will be allowed to complete even if the user aborts
-; the request. Consider enabling it if executing long request, which may end up
-; being interrupted by the user or a browser timing out.
-; ignore_user_abort = On

 ; Misc
@@ -354,12 +350,12 @@
 ; instead (see below).  Keeping display_errors enabled on a production web site
 ; may reveal security information to end users, such as file paths on your Web
 ; server, your database schema or other information.
-display_errors = Off
+display_errors = On

 ; Even when display_errors is on, errors that occur during PHP's startup
 ; sequence are not displayed.  It's strongly recommended to keep
 ; display_startup_errors off, except for when debugging.
-display_startup_errors = Off
+display_startup_errors = On

 ; Log errors into a log file (server-specific log, stderr, or error_log (below))
 ; As stated above, you're strongly advised to use error logging in place of
@@ -484,7 +480,7 @@
 ;default_charset = "iso-8859-1"

 ; Always populate the $HTTP_RAW_POST_DATA variable.
-;always_populate_raw_post_data = On
+always_populate_raw_post_data = On

@@ -492,7 +488,7 @@

 ; UNIX: "/path1:/path2"
-;include_path = ".:/php/includes"
+include_path = ".:/usr/local/php5/lib/php:/usr/share/php"
 ; Windows: "\path1;\path2"
 ;include_path = ".;c:\php\includes"
@@ -937,7 +933,7 @@
 ; where MODE is the octal representation of the mode. Note that this
 ; does not overwrite the process's umask.
-;session.save_path = "/tmp"
+session.save_path = "/var/lib/php/session"

 ; Whether to use cookies.
 session.use_cookies = 1
@@ -1025,7 +1021,7 @@
 ;   in publically accessible computer.
 ; - User may access your site with the same session ID
 ;   always using URL stored in browser's history or bookmarks.
-session.use_trans_sid = 0
+session.use_trans_sid = 1

 ; Select a hash function
 ; 0: MD5   (128 bits)
@@ -1150,6 +1146,10 @@
 ; Default proxy password.
 ;pfpro.proxypassword =

+; Use the system read() function instead of the php_read() wrapper.
+sockets.use_system_read = On
 ; path to a file containing GUIDs, IIDs or filenames of files with TypeLibs
 ;com.typelib_file =
 [2005-03-25 23:55 UTC]
I still can not reproduce this problem with using exactly same  php.ini as you do. And you really need to put something more into httpd.conf to enable PHP than just that LoadModule line.
So HOW have you configured PHP in there?

 [2005-03-26 21:12 UTC] jnavratil at houston dot rr dot com
The following is a unified diff of httpd.conf and httpd-std.conf.  Am I missing something?  I confess I am a bit out of my depth, and am more than willing to read any documentation you suggest.  (BTW, I am not having this problem on my FC3 box).

--- httpd.conf  2005-03-19 12:38:29.000000000 -0600
+++ httpd-std.conf      2005-02-21 13:08:40.000000000 -0600
@@ -229,8 +229,6 @@
 # Example:
 # LoadModule foo_module modules/
-LoadModule php5_module        modules/
-AddType application/x-httpd-php .php

@@ -393,7 +391,7 @@
 # negotiated documents.  The MultiViews Option can be used for the
 # same purpose, but it is much slower.
-DirectoryIndex index.html index.html.var index.php
+DirectoryIndex index.html index.html.var

 # AccessFileName: The name of the file to look for in each directory
 [2005-03-31 00:02 UTC]
And you don't set any funny things in ANY .htaccess file?
And you're REALLY running latest CVS snapshot?
Get this:

And do this (EXACTLY THIS):

# ./configure --disable-all --disable-cli --with-prefix=/usr/local/php5 --with-apxs2=/usr/local/apache2/bin/apxs
# make install-sapi

Then first STOP apache and make sure it really is dead,
and after making sure it was not still running, start it.

 [2005-04-02 00:40 UTC] jnavratil at houston dot rr dot com
Here be gremlins!

FYI - I had not setup any .htaccess files, at all.  I was running the 3/19 snapshot, but reloaded the latest as you asked, then rebuilt using your suggested configure options.


So I rebuilt using my configuration and my script still worked.  I tested my app and....

the include_path was not being correctly set.  Other changes to php.ini were reflected in phpinfo(), but changes to the include_path were not (I verified each directory existed).  I fussed with that for a while and got my app running by setting the path within the script.  (Not good!).

So I decided to run my test script under Mozilla (I had been using Konqueror) and IT FAILED as before.  Furthermore, it now failed under Konqueror.  Only when I stopped Mozilla would the test script run correctly under Konqueror.

At this point, I have no clue what is failing and will continue testing.  

Thanks for your help.  Obviously, if you have any suggestions for me, I would appreciate hearing them (perhaps debugging techniques I, as a long-time 'C' programmer, might employ).  I don't think any further efforts on your behalf are required.
PHP Copyright © 2001-2023 The PHP Group
All rights reserved.
Last updated: Fri Dec 08 20:01:28 2023 UTC