Solved

PHP $_POST problem in apache php. Posting more than 10 characters doesnt work

Posted on 2008-10-24
9
256 Views
Last Modified: 2013-12-13
GoodEvening.

We are just about to go live in our new VPS server, unfortunately we have a VERY frustrating problem.

The VPS just got upgraded to PHP ver 5.2.5, and since then HTTP POST does not work as expected. As you can understand it completely breaks our application.

We have identified the problem and is seems to be related to the configuration of either apache (httpd.conf) or php (php.ini).

The problem:
You have an HTML form with a text input field. If you enter 10 characters (0123456789) it gets posted ok, and PHP reads the _POST variable. If you post more than 10 characters (01234567891) php doesnt read the variable.


Thank you in advance.


<?php
error_reporting(E_ALL);
echo $_POST['text1'];
?>
<html>
<head>
<title></title>
</head>
<body>
<form method="post" action="broken.php">
<input type="text" name="text1">
<input type="submit" value="Send">
</form>
</body>
</html>

Open in new window

0
Comment
Question by:heckyEXPERT
9 Comments
 
LVL 9

Expert Comment

by:Sander Stad
ID: 22795097
Can you try to set the output_buffering tothe following in the php.ini:
 

output_buffering = On

Open in new window

0
 

Author Comment

by:heckyEXPERT
ID: 22795154
Sstad, I did it , restarted the server, problem persists. No change
0
 
LVL 13

Expert Comment

by:AielloJ
ID: 22795925
I'm wondering if the unspecified length of your text1 field is using some default in the PHP interpreter.  Try assigning size and maxlength attributes and see if it helps.

<input type="text" name="text1" size="25" maxlength="25">

0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

Author Comment

by:heckyEXPERT
ID: 22795972
AielloJ thank you for your input. Unfortunately the problem still persists.

In fact, I've contacted Tier 1 tech support on my VPS host and they gave the problem a try. The support technician "made some changes" as he told me. Now the limit has gone from 10 characters to only 2 characters. They've propagated the problem to Tier 2.

0
 
LVL 1

Expert Comment

by:cristides
ID: 22795982
Notice: Undefined index: text1 in tst.php on line 3 , i think you want to autocomplete to text1 if not, you must to change from _POST to _GET
0
 
LVL 13

Expert Comment

by:AielloJ
ID: 22796046
heckyEXPERT:

I'd be interested in what the solution is when you get it.  Nothing to put your mind at ease like the "improvements" in the condition from tech support!! LOL  Seriously though, it seems like tech support is playing around in the right neighborhood if they were able to affect the problem.
0
 

Author Comment

by:heckyEXPERT
ID: 22796092
AielloJ,

When the solution comes in from tech support , assuming they are not to embarrassed as to explaining the source and the fix of the problem, i will post it here.

As an aside, its funny how things like that can hold of a commercial project from going live for a number of days. I guess a VPS is still a VPS, and however "isolated" and "complete root access" you have, you still have a box within another box, and there are always some cpanel/virtuozo application running messing up your config files without your knowledge.
0
 
LVL 13

Expert Comment

by:AielloJ
ID: 22796466
heckyEXPERT:

I agree.  From the business and operations side, most companies have a moratorium on any IT platform and software changes at critical times in their business cycle.  Like tax season if you're an accounting firm, etc.  If your using a VPS within your company, there should be a formal upgrade process that contains a "backout plan" at each step of the process that details how to return to the prior condition if the upgrade fails.  If your VPS is owned and managed by an outside firm, the Service Level Agreement should require your firms agreement to the scheduling of major revisions & changes.  Don't know if either of these are applicable in your case, but if they are you can take them to management and possibly get the rules implemented, or other resources needed budgeted.

JRA
0
 

Accepted Solution

by:
heckyEXPERT earned 0 total points
ID: 22804146
Problem was fixed.. (not by my tech support, still waiting for their communication).

All i did was get a fresh php.ini.recommended from the latest php distro and made some small changes to reflect my VPS setup (location of php module etc)

Thanks everyone for their input
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I imagine that there are some, like me, who require a way of getting currency exchange rates for implementation in web project from time to time, so I thought I would share a solution that I have developed for this purpose. It turns out that Yaho…
If you are a web developer, you would be aware of the <iframe> tag in HTML. The <iframe> stands for inline frame and is used to embed another document within the current HTML document. The embedded document could be even another website.
The viewer will learn how to count occurrences of each item in an array.
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.

749 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question