?
Solved

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

Posted on 2008-10-24
9
Medium Priority
?
259 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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
NEW Veeam Agent for Microsoft Windows

Backup and recover physical and cloud-based servers and workstations, as well as endpoint devices that belong to remote users. Avoid downtime and data loss quickly and easily for Windows-based physical or public cloud-based workloads!

 

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

Optimize your web performance

What's in the eBook?
- Full list of reasons for poor performance
- Ultimate measures to speed things up
- Primary web monitoring types
- KPIs you should be monitoring in order to increase your ROI

Question has a verified solution.

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

Things That Drive Us Nuts Have you noticed the use of the reCaptcha feature at EE and other web sites?  It wants you to read and retype something that looks like this. Insanity!  It's not EE's fault - that's just the way reCaptcha works.  But it i…
There are times when I have encountered the need to decompress a response from a PHP request. This is how it's done, but you must have control of the request and you can set the Accept-Encoding header.
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.
Suggested Courses

801 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