Re: [PHP] HOWTO run PHP4 and PHP5 on Apache/Linux

2004-08-12 Thread AJL
On Sun, Aug 08, 2004 at 03:29:18PM -0500, AJL wrote:
 On Tue, Aug 03, 2004 at 10:04:11PM -0500, AJL wrote:
  
  I ran into so many problems trying to set this up that I thought I'd
  post my notes to hopefully save others some trouble.
  
  I found most of the information I needed at:
  http://rayh.co.uk/archives/13_PHP5__PHP4_side_by_side.html
  but the link doesn't seem to be working anymore, so here are my notes.
  
  Versions:
  PHP4.x module (already compiled and installed, this was
  straightforward in docs at www.php.net)
  PHP5.0.0 cgi
  RedHat linux 6.x
  Apache 1.3.22
  
  PHP5 configure command:
  ./configure \
  --prefix=/usr/local/php/php5.0.0 \
  --with-config-file-path=/usr/local/php/php5.0.0/ \
  --with-config-file=/usr/local/php/php5.0.0/php.ini \
  --enable-force-cgi-redirect \
  --disable-path-info-check \
  --enable-safe-mode \
  --disable-short-tags \
  --with-regex=system \
  --with-mysql \
  --enable-debug \
  --with-mcrypt \
  --enable-versioning \
  --disable-libxml
  
  NOTE: when I enabled '--enable-discard-path', pages would load blank.
  Don't use this unless you know what you are doing.  I don't understand
  exactly what this does.
  
  NOTE: The options '--with-apxs' and '--with-apache' tell configure to
  build apache module and CLI.  The absence of these tells it to build
  the CGI version.  So DO NOT USE them if you want the CGI version.
  
  make
  make test
  make install
  
  
  Add the following to httpd.conf (must be in the generic server
  settings, NOT in a virtual host):
  ScriptAlias /cgi-php5/ /usr/local/php/php5.0.0/bin/
  Directory /usr/local/php/php5.0.0/bin/
  Options +ExecCGI
  Allow From All
  /Directory
  
  
  Foreach virtual host you want to use php5 on:
  Create a directory named 'cgi-php5' one level above the document root.
  This will most likely be in the same directory that has the cgi-bin
  directory in it.
  
  
  Foreach directory that you want to us php5 for:
  Add the following to .htaccess file (or virtual host inside a
  Directory container):
  Action php5-script /cgi-php5/php
  AddHandler php5-script .php
  Options +ExecCGI
  
  This is an excellent solution because:
   - You only have to restart apache once.  After that, you can add
  .htaccess files to enable php5 interpretation whereever you want.
   - You can upgrade/downgrade php5 without touching apache.
   - You don't have clunky file extensions like .php5 or anything else
  that will be difficult to change later on down the road.
  
  PROBLEMS: So far, I cannot figure out why $_POST is empty when an html
  form is sent with method=post.  GET works fine.  In all my searching,
  I think it has something to do with how apache is setup; not with how
  php is configured.  I've tried the default php-dist ini file, I've tried
  many different variations of php configure commands.  None of them do
  the trick.  PHP bug list has some posts from people with the same problem
  and then they said they found a problem in apache setup that fixed it.
  
  -- 
  PHP General Mailing List (http://www.php.net/)
  To unsubscribe, visit: http://www.php.net/unsub.php
 
 PROBLEM RESOLUTION:  
 I finally found the problem: It was the mod_bandwidth module in
 Apache.  I was tipped off to this from bug report:
 http://bugs.php.net/bug.php?id=16595
 I disabled the module (commented the LoadModule and AddModule lines in
 httpd.conf) and $_POST is populated as expected now.
 
 The faq for mod_bandwidth at:
 http://www.cohprog.com/v3/bandwidth/faq-en.html
 indicates that if configured incorrectly, CGI may stop working.
 
 --
 Andy
 
 -- 
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php

Yet another note:  DO NOT include the configure directive
'--disable-libxml' as the above example shows.  This will cause the
PEAR installation to fail.  (Of course, if you don't want PEAR or xml
support, feel free to leave it in.  If you don't know if you need/want
PEAR and xml, just go ahead and allow them to be included and remove
'--disable-libxml' from the configure command.)

--
Andy

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] HOWTO run PHP4 and PHP5 on Apache/Linux

2004-08-08 Thread AJL
On Tue, Aug 03, 2004 at 10:04:11PM -0500, AJL wrote:
 
 I ran into so many problems trying to set this up that I thought I'd
 post my notes to hopefully save others some trouble.
 
 I found most of the information I needed at:
 http://rayh.co.uk/archives/13_PHP5__PHP4_side_by_side.html
 but the link doesn't seem to be working anymore, so here are my notes.
 
 Versions:
 PHP4.x module (already compiled and installed, this was
 straightforward in docs at www.php.net)
 PHP5.0.0 cgi
 RedHat linux 6.x
 Apache 1.3.22
 
 PHP5 configure command:
 ./configure \
 --prefix=/usr/local/php/php5.0.0 \
 --with-config-file-path=/usr/local/php/php5.0.0/ \
 --with-config-file=/usr/local/php/php5.0.0/php.ini \
 --enable-force-cgi-redirect \
 --disable-path-info-check \
 --enable-safe-mode \
 --disable-short-tags \
 --with-regex=system \
 --with-mysql \
 --enable-debug \
 --with-mcrypt \
 --enable-versioning \
 --disable-libxml
 
 NOTE: when I enabled '--enable-discard-path', pages would load blank.
 Don't use this unless you know what you are doing.  I don't understand
 exactly what this does.
 
 NOTE: The options '--with-apxs' and '--with-apache' tell configure to
 build apache module and CLI.  The absence of these tells it to build
 the CGI version.  So DO NOT USE them if you want the CGI version.
 
 make
 make test
 make install
 
 
 Add the following to httpd.conf (must be in the generic server
 settings, NOT in a virtual host):
 ScriptAlias /cgi-php5/ /usr/local/php/php5.0.0/bin/
 Directory /usr/local/php/php5.0.0/bin/
 Options +ExecCGI
 Allow From All
 /Directory
 
 
 Foreach virtual host you want to use php5 on:
 Create a directory named 'cgi-php5' one level above the document root.
 This will most likely be in the same directory that has the cgi-bin
 directory in it.
 
 
 Foreach directory that you want to us php5 for:
 Add the following to .htaccess file (or virtual host inside a
 Directory container):
 Action php5-script /cgi-php5/php
 AddHandler php5-script .php
 Options +ExecCGI
 
 This is an excellent solution because:
  - You only have to restart apache once.  After that, you can add
 .htaccess files to enable php5 interpretation whereever you want.
  - You can upgrade/downgrade php5 without touching apache.
  - You don't have clunky file extensions like .php5 or anything else
 that will be difficult to change later on down the road.
 
 PROBLEMS: So far, I cannot figure out why $_POST is empty when an html
 form is sent with method=post.  GET works fine.  In all my searching,
 I think it has something to do with how apache is setup; not with how
 php is configured.  I've tried the default php-dist ini file, I've tried
 many different variations of php configure commands.  None of them do
 the trick.  PHP bug list has some posts from people with the same problem
 and then they said they found a problem in apache setup that fixed it.
 
 -- 
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php

PROBLEM RESOLUTION:  
I finally found the problem: It was the mod_bandwidth module in
Apache.  I was tipped off to this from bug report:
http://bugs.php.net/bug.php?id=16595
I disabled the module (commented the LoadModule and AddModule lines in
httpd.conf) and $_POST is populated as expected now.

The faq for mod_bandwidth at:
http://www.cohprog.com/v3/bandwidth/faq-en.html
indicates that if configured incorrectly, CGI may stop working.

--
Andy

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Re: POST superglobal is empty [RESOLVED]

2004-08-07 Thread AJL
Hi All,
I finally found the problem: It was the mod_bandwidth module in
Apache.  I was tipped off to this from bug report:
http://bugs.php.net/bug.php?id=16595
I disabled the module (commented the LoadModule and AddModule lines in
httpd.conf) and $_POST is populated as expected now.

The faq for mod_bandwidth at:
http://www.cohprog.com/v3/bandwidth/faq-en.html
indicates that if configured incorrectly, CGI may stop working.

FYI: Regarding my other questions:
The code below shows an example of reading data from stdin.  If POST
data is read properly by php, there will be nothing on stdin.
However, if you set post_max_size to a (very) small value, there will
be something on stdin and the code below will read and display it.
You will also get a warning that CONTENT_LENGTH is greater than
post_max_size.  The code compares the values of CONTENT_LENGTH and
post_max_size and warns if post_max_size is smaller.

Hope this helps all of you out there who are having similar problems.

--
Andy

On Thu, Aug 05, 2004 at 03:47:35PM -0500, AJL wrote:
 I tried the C code below and I get post data from Apache fine.
 
 Now I tried to test that php gets data on stdin and that appears to
 fail.  Maybe I tested wrong, can anyone verify if this test should
 work?
 
 Step 1: Set 'post_max_size = 1' in php.ini
 
 Step 2: Send html form post to this code:
 ?php
 if($_ENV['REQUEST_METHOD'] == 'POST')
 {
 if (strcasecmp($_ENV['REQUEST_METHOD'], 'POST') == 0)
 {
 $cl = $_ENV['CONTENT_LENGTH'];
 $stdin = fopen('php://stdin', 'r');
 if(!$stdin) {print('Error opening stdin'); exit(1);}
 $raw_data = fgets($stdin, $cl);
 fclose($stdin);
 print(STDINbrSTRLEN = .strlen($raw_data));
 print('pre');
 print($raw_data);
 print('/pre');
 }
 }
 print('hrENVpre');
 print_r($_ENV);
 print('/pre');
 ?
 
 
 ENV variables all look correct.  stdin ($raw_data) appears to be
 empty, strlen returns 0.  The CONTENT_LENGTH environment variable is
 reported correctly and changes according to how much data is posted.
 
 Is fopen('php://stdin', 'r'); the correct way to read from stdin?
 
 Are there any other ways to read from stdin?
 
 Is post_max_size = 1 a valid setting?
 
 --
 Andy
 
 
 On Wed, Aug 04, 2004 at 11:18:26PM -0500, AJL wrote:
  
  Yeah, I would expect a 50x response for a Deny from all.  I tried 
  adding the Limit directive to .htacces in both the cgi directory and
  the www directory, no luck:
  Limit POST
  Order Allow,Deny
  Allow from all
  /Limit
  
  I found this C code:
  ftp://ftp.ncsa.uiuc.edu/Web/httpd/Unix/ncsa_httpd/cgi/cgi-src/post-query.c
  
  and compiled it and redirected my sample code (posted earlier) and I
  get the posted form variables fine.  So maybe Apache CGI setup is
  working okay.
  
  The next logical step seems to be to see what php is getting on stdin
  and what environment variables are set.  I know I can check the
  environment variables with $_ENV.  Anyone know how I can get an exact
  copy of the data that was passed on stdin?
  
  --
  Andy
  
  On Thu, Aug 05, 2004 at 03:20:23AM +, Curt Zirzow wrote:
   * Thus wrote AJL:
On Wed, Aug 04, 2004 at 02:55:16PM -0700, Justin Patrin wrote:
 
 Sounds like Apache just isn't passing in POST data. Are you *sure*
 there's Apache directive for this?
Yeah, that's what I'm thinking more and more, apache not passing it in
or in a way that php is not understanding.

Anyone know of possible apache settings/directives that affect how CGI
programs are invoked and/or how data is passed to them?
   
   Location /cgi-bin # or similar
 Limit POST
   Order deny,allow
   Deny from all
 /Limit
   /Location
   
   But, you technically should get a 50x error with that.
   
   
   Curt
   -- 
   First, let me assure you that this is not one of those shady pyramid schemes
   you've been hearing about.  No, sir.  Our model is the trapezoid!
   
   -- 
   PHP General Mailing List (http://www.php.net/)
   To unsubscribe, visit: http://www.php.net/unsub.php
  
  -- 
  PHP General Mailing List (http://www.php.net/)
  To unsubscribe, visit: http://www.php.net/unsub.php
 
 -- 
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Re: POST superglobal is empty

2004-08-05 Thread AJL
Not a dumb idea, I have tried that with no success.   Thanks for the
ideas.  Keep 'em coming.  I recall seeing a conversation somewhere
(php bugs, I think) that there is a function to call that will return
the raw input from stdin.  Anyone know what that function is?
--
Andy

On Thu, Aug 05, 2004 at 02:46:48PM +1000, Paul Birnstihl wrote:
 Might be a dumb idea but have you tried putting method=POST instead of 
 method=post ?
 
 
 Andy Loftus wrote:
  Does anyone have any ideas as to why $_POST would be empty when 
  submitting a form to php?
  
 
 -- 
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Re: POST superglobal is empty

2004-08-05 Thread AJL
I tried the C code below and I get post data from Apache fine.

Now I tried to test that php gets data on stdin and that appears to
fail.  Maybe I tested wrong, can anyone verify if this test should
work?

Step 1: Set 'post_max_size = 1' in php.ini

Step 2: Send html form post to this code:
?php
if($_ENV['REQUEST_METHOD'] == 'POST')
{
if (strcasecmp($_ENV['REQUEST_METHOD'], 'POST') == 0)
{
$cl = $_ENV['CONTENT_LENGTH'];
$stdin = fopen('php://stdin', 'r');
if(!$stdin) {print('Error opening stdin'); exit(1);}
$raw_data = fgets($stdin, $cl);
fclose($stdin);
print(STDINbrSTRLEN = .strlen($raw_data));
print('pre');
print($raw_data);
print('/pre');
}
}
print('hrENVpre');
print_r($_ENV);
print('/pre');
?


ENV variables all look correct.  stdin ($raw_data) appears to be
empty, strlen returns 0.  The CONTENT_LENGTH environment variable is
reported correctly and changes according to how much data is posted.

Is fopen('php://stdin', 'r'); the correct way to read from stdin?

Are there any other ways to read from stdin?

Is post_max_size = 1 a valid setting?

--
Andy


On Wed, Aug 04, 2004 at 11:18:26PM -0500, AJL wrote:
 
 Yeah, I would expect a 50x response for a Deny from all.  I tried 
 adding the Limit directive to .htacces in both the cgi directory and
 the www directory, no luck:
 Limit POST
 Order Allow,Deny
   Allow from all
 /Limit
 
 I found this C code:
 ftp://ftp.ncsa.uiuc.edu/Web/httpd/Unix/ncsa_httpd/cgi/cgi-src/post-query.c
 
 and compiled it and redirected my sample code (posted earlier) and I
 get the posted form variables fine.  So maybe Apache CGI setup is
 working okay.
 
 The next logical step seems to be to see what php is getting on stdin
 and what environment variables are set.  I know I can check the
 environment variables with $_ENV.  Anyone know how I can get an exact
 copy of the data that was passed on stdin?
 
 --
 Andy
 
 On Thu, Aug 05, 2004 at 03:20:23AM +, Curt Zirzow wrote:
  * Thus wrote AJL:
   On Wed, Aug 04, 2004 at 02:55:16PM -0700, Justin Patrin wrote:

Sounds like Apache just isn't passing in POST data. Are you *sure*
there's Apache directive for this?
   Yeah, that's what I'm thinking more and more, apache not passing it in
   or in a way that php is not understanding.
   
   Anyone know of possible apache settings/directives that affect how CGI
   programs are invoked and/or how data is passed to them?
  
  Location /cgi-bin # or similar
Limit POST
  Order deny,allow
  Deny from all
/Limit
  /Location
  
  But, you technically should get a 50x error with that.
  
  
  Curt
  -- 
  First, let me assure you that this is not one of those shady pyramid schemes
  you've been hearing about.  No, sir.  Our model is the trapezoid!
  
  -- 
  PHP General Mailing List (http://www.php.net/)
  To unsubscribe, visit: http://www.php.net/unsub.php
 
 -- 
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Re: POST superglobal is empty

2004-08-04 Thread AJL
yeah, Dan's code fails as well.  here's my code:

---START SNIP SNIP---
?php

print('POSTpre');
print_r($_POST);
print('/prebrGETpre');
print_r($_GET);
print('/prebrREQUESTpre');
print_r($_REQUEST);
print('/pre');

?

hr
h3POST FORM/h3
form action=test.php method=POST
field one:
input type=text name=f_1
br
field two:
input type=text name=f_2
pbr
input name=Submit type=submit value=Post
input name=Cancel type=reset id=Cancel value=Cancel
/form

p
hr
h3GET FORM/h3
form action=test.php method=GET
field one:
input type=text name=f_1
br
field two:
input type=text name=f_2
pbr
input name=Submit type=submit value=Get
input name=Cancel type=reset id=Cancel value=Cancel
/form
---END SNIP SNIP---


--
Andy

On Wed, Aug 04, 2004 at 07:56:52AM -0700, Dan Phiffer wrote:
 Craig Donnelly wrote:
  Show the code you are using...
 
 I'm having the same problem. Here is a test script that prints Array() 
 regardless of what you enter and submit with the form:
 
 -- test.php --
 ?php print_r($_POST); ?
 form method=post action=test.php
 input type=text name=foo/
 input type=submit/
 /form
 
 -- 
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Re: POST superglobal is empty

2004-08-04 Thread AJL
I'm not sure if it is Apache or not.  In fact, I wonder that it might
be.  However, I do not have any clue as to what it could be.

We have 1 apache server running.  It currently has php4.1.1 built as
apache module.  Code works fine for this build.  In addition, I have
php4.3.8 and php5.0.0 built as cgi.  This code fails against both
php4.3.8 and php5.0.0.  Makes me think it has something to do with CGI
in apache.  Again, I have no clue what this might be.  As I mentioned
earlier, I've looked through all the bugs on php.net and other
newsgroups, mailing lists, FAQ's.  All the solutions posted in the
past are not in effect on my server.  I can find nothing wrong.
I have also tried a copy of the 4.1.1 php.ini file for php5.0.0 with no
luck.  

Hints, suggestions, pointers are all welcome.  Apparently this is a
common problem.

--
Andy

On Wed, Aug 04, 2004 at 01:20:00PM -0400, John W. Holmes wrote:
 From: Dan Phiffer [EMAIL PROTECTED]
  Jason Davidson wrote:
 
   How about
   print_r($_REQUEST);
 
  That also fails to reflect posted data. $_GET is working as expected.
 
 There's nothing in PHP that would not let POST values get through. Are you
 sure this isn't a web server issue only allowing GET requests to pages that
 it serves?
 
 ---John Holmes...
 
 -- 
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Re: POST superglobal is empty

2004-08-04 Thread AJL
I am certain php is configured as CGI, as per:

--SNIP SNIP--
$ ./php -v
PHP 5.0.0 (cgi) (built: Aug  3 2004 21:18:23) (DEBUG)
Copyright (c) 1997-2004 The PHP Group
Zend Engine v2.0.0, Copyright (c) 1998-2004 Zend Technologies
--SNIP SNIP--

I'm using (for the time being) the default php.ini-dist from the
source directory.   I know this has pretty lax configuration settings.

I didn't realize there are all those other versions (don't know where
they are) but I have defined the config-file-path and config-file on
the php configure line so it only looks in one place.

I'm going to continue looking at apache settings/configuration.  I
can't find any suspect settings in the config file, but maybe
something was compiled in as a default.
Anyone know how to find out what options/settings the httpd binary has
compiled in? 

--
Andy

On Thu, Aug 05, 2004 at 02:00:24AM +, Curt Zirzow wrote:
 * Thus wrote Dan Phiffer:
  John W. Holmes wrote:
  
  There's nothing in PHP that would not let POST values get through.
  
  Well, I think there are means of disabling the registration of $_POST, 
  but that's not relevent to this problem.
 
 why not? 
 
 Things that will prevent _POST from being filled out:
 
   variable_order=GC ; lacks P
 
   post_max_size=8 ; missing M at the end.
   ; or a small number disallowing it from 
   ; being set.
 
   the php binary your using isn't really a cgi binary but the CLI
   version of php.
  
   Ensure you are using the right php.ini, there are multiple
   version's depending on what they are named php[-{sapi}].ini
 
 nullUses builtin default settings
 php.ini The default ini
 php-cgi.ini for CGI applications
 php-apache.ini  For apache
 php-cli.ini For CLI
 ...
 
 
 Curt
 -- 
 First, let me assure you that this is not one of those shady pyramid schemes
 you've been hearing about.  No, sir.  Our model is the trapezoid!
 
 -- 
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Re: POST superglobal is empty

2004-08-04 Thread AJL
On Wed, Aug 04, 2004 at 01:53:17PM -0700, Justin Patrin wrote:
 On Wed, 4 Aug 2004 13:20:00 -0400, John W. Holmes
 [EMAIL PROTECTED] wrote:
  From: Dan Phiffer [EMAIL PROTECTED]
   Jason Davidson wrote:
  
How about
print_r($_REQUEST);
  
   That also fails to reflect posted data. $_GET is working as expected.
  
  There's nothing in PHP that would not let POST values get through. Are you
  sure this isn't a web server issue only allowing GET requests to pages that
  it serves?
  
 
 Or possibly a proxy or firewall or your browser stopping it?
I don't think any of these considering that the code works fine under
the default php4.1.1 built as apache module.

 
 -- 
 DB_DataObject_FormBuilder - The database at your fingertips
 http://pear.php.net/package/DB_DataObject_FormBuilder
 
 paperCrane --Justin Patrin--
 
 -- 
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Re: POST superglobal is empty

2004-08-04 Thread AJL
On Wed, Aug 04, 2004 at 02:55:16PM -0700, Justin Patrin wrote:
 On Wed, 4 Aug 2004 16:47:45 -0500, AJL [EMAIL PROTECTED] wrote:
  I'm not sure if it is Apache or not.  In fact, I wonder that it might
  be.  However, I do not have any clue as to what it could be.
  
  We have 1 apache server running.  It currently has php4.1.1 built as
  apache module.  Code works fine for this build.  In addition, I have
  php4.3.8 and php5.0.0 built as cgi.  This code fails against both
  php4.3.8 and php5.0.0.  Makes me think it has something to do with CGI
  in apache.  Again, I have no clue what this might be.  As I mentioned
  earlier, I've looked through all the bugs on php.net and other
  newsgroups, mailing lists, FAQ's.  All the solutions posted in the
  past are not in effect on my server.  I can find nothing wrong.
  I have also tried a copy of the 4.1.1 php.ini file for php5.0.0 with no
  luck.
  
  Hints, suggestions, pointers are all welcome.  Apparently this is a
  common problem.
 
 Sounds like Apache just isn't passing in POST data. Are you *sure*
 there's Apache directive for this?
Yeah, that's what I'm thinking more and more, apache not passing it in
or in a way that php is not understanding.

Anyone know of possible apache settings/directives that affect how CGI
programs are invoked and/or how data is passed to them?

--
Andy

 
 P.S. *Why* do you have PHP 4.1.1 as the default?
 
  
  --
  Andy
  
  
  
  On Wed, Aug 04, 2004 at 01:20:00PM -0400, John W. Holmes wrote:
   From: Dan Phiffer [EMAIL PROTECTED]
Jason Davidson wrote:
   
 How about
 print_r($_REQUEST);
   
That also fails to reflect posted data. $_GET is working as expected.
  
   There's nothing in PHP that would not let POST values get through. Are you
   sure this isn't a web server issue only allowing GET requests to pages that
   it serves?
  
   ---John Holmes...
  
   --
   PHP General Mailing List (http://www.php.net/)
   To unsubscribe, visit: http://www.php.net/unsub.php
  
 
 -- 
 DB_DataObject_FormBuilder - The database at your fingertips
 http://pear.php.net/package/DB_DataObject_FormBuilder
 
 paperCrane --Justin Patrin--
 
 -- 
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Re: POST superglobal is empty

2004-08-04 Thread AJL

Yeah, I would expect a 50x response for a Deny from all.  I tried 
adding the Limit directive to .htacces in both the cgi directory and
the www directory, no luck:
Limit POST
Order Allow,Deny
Allow from all
/Limit

I found this C code:
ftp://ftp.ncsa.uiuc.edu/Web/httpd/Unix/ncsa_httpd/cgi/cgi-src/post-query.c

and compiled it and redirected my sample code (posted earlier) and I
get the posted form variables fine.  So maybe Apache CGI setup is
working okay.

The next logical step seems to be to see what php is getting on stdin
and what environment variables are set.  I know I can check the
environment variables with $_ENV.  Anyone know how I can get an exact
copy of the data that was passed on stdin?

--
Andy

On Thu, Aug 05, 2004 at 03:20:23AM +, Curt Zirzow wrote:
 * Thus wrote AJL:
  On Wed, Aug 04, 2004 at 02:55:16PM -0700, Justin Patrin wrote:
   
   Sounds like Apache just isn't passing in POST data. Are you *sure*
   there's Apache directive for this?
  Yeah, that's what I'm thinking more and more, apache not passing it in
  or in a way that php is not understanding.
  
  Anyone know of possible apache settings/directives that affect how CGI
  programs are invoked and/or how data is passed to them?
 
 Location /cgi-bin # or similar
   Limit POST
 Order deny,allow
 Deny from all
   /Limit
 /Location
 
 But, you technically should get a 50x error with that.
 
 
 Curt
 -- 
 First, let me assure you that this is not one of those shady pyramid schemes
 you've been hearing about.  No, sir.  Our model is the trapezoid!
 
 -- 
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] HOWTO run PHP4 and PHP5 on Apache/Linux

2004-08-03 Thread AJL

I ran into so many problems trying to set this up that I thought I'd
post my notes to hopefully save others some trouble.

I found most of the information I needed at:
http://rayh.co.uk/archives/13_PHP5__PHP4_side_by_side.html
but the link doesn't seem to be working anymore, so here are my notes.

Versions:
PHP4.x module (already compiled and installed, this was
straightforward in docs at www.php.net)
PHP5.0.0 cgi
RedHat linux 6.x
Apache 1.3.22

PHP5 configure command:
./configure \
--prefix=/usr/local/php/php5.0.0 \
--with-config-file-path=/usr/local/php/php5.0.0/ \
--with-config-file=/usr/local/php/php5.0.0/php.ini \
--enable-force-cgi-redirect \
--disable-path-info-check \
--enable-safe-mode \
--disable-short-tags \
--with-regex=system \
--with-mysql \
--enable-debug \
--with-mcrypt \
--enable-versioning \
--disable-libxml

NOTE: when I enabled '--enable-discard-path', pages would load blank.
Don't use this unless you know what you are doing.  I don't understand
exactly what this does.

NOTE: The options '--with-apxs' and '--with-apache' tell configure to
build apache module and CLI.  The absence of these tells it to build
the CGI version.  So DO NOT USE them if you want the CGI version.

make
make test
make install


Add the following to httpd.conf (must be in the generic server
settings, NOT in a virtual host):
ScriptAlias /cgi-php5/ /usr/local/php/php5.0.0/bin/
Directory /usr/local/php/php5.0.0/bin/
Options +ExecCGI
Allow From All
/Directory


Foreach virtual host you want to use php5 on:
Create a directory named 'cgi-php5' one level above the document root.
This will most likely be in the same directory that has the cgi-bin
directory in it.


Foreach directory that you want to us php5 for:
Add the following to .htaccess file (or virtual host inside a
Directory container):
Action php5-script /cgi-php5/php
AddHandler php5-script .php
Options +ExecCGI

This is an excellent solution because:
 - You only have to restart apache once.  After that, you can add
.htaccess files to enable php5 interpretation whereever you want.
 - You can upgrade/downgrade php5 without touching apache.
 - You don't have clunky file extensions like .php5 or anything else
that will be difficult to change later on down the road.

PROBLEMS: So far, I cannot figure out why $_POST is empty when an html
form is sent with method=post.  GET works fine.  In all my searching,
I think it has something to do with how apache is setup; not with how
php is configured.  I've tried the default php-dist ini file, I've tried
many different variations of php configure commands.  None of them do
the trick.  PHP bug list has some posts from people with the same problem
and then they said they found a problem in apache setup that fixed it.

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php