Solved

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

Posted on 2008-10-24
9
228 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
 

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
Free Gift Card with Acronis Backup Purchase!

Backup any data in any location: local and remote systems, physical and virtual servers, private and public clouds, Macs and PCs, tablets and mobile devices, & more! For limited time only, buy any Acronis backup products and get a FREE Amazon/Best Buy gift card worth up to $200!

 
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

Threat Intelligence Starter Resources

Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
lastpass auto fill login form 5 24
Not needed 13 55
Why does my array not "dump?" 5 19
Tracking Bouncebacks in PHPMailer 3 9
Password hashing is better than message digests or encryption, and you should be using it instead of message digests or encryption.  Find out why and how in this article, which supplements the original article on PHP Client Registration, Login, Logo‚Ķ
This article discusses how to create an extensible mechanism for linked drop downs.
The viewer will learn how to count occurrences of each item in an array.
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.

758 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

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now