Apache / PHP issue, 1 page on my site has suddenly stopped outputting content 1/2 way through?


I have a page within a payment system (PHP 5.6.0 served by Apache 2.4.10) which all of a sudden has literally stopped outputting 1/2 way down a page cutting off all the HTML.

Any ideas what may be suddenly causing this? The server has not been altered this week, neither has the code, i'm stumped as it has worked for the last 9+ months

Every other payment on the server (over 50 written exactly the same, although smaller amounts of HTML works fine. The page that is stopping does have around 150 <option> elements but its always worked until now.

 <option value=""></option>
          <option value="club-gaming-club-machine-permit-existing-operator" >Club Gaming Club Machine Permit Existing Operator :: &pound;100.00</option>
          <option value="club-gaming-club-machine-permit-new-operator" >Club Gaming Club Machine Permit New Operator :: &pound;200.00</option>
          <option value="club-gaming-club-machine-permit-renewal" >Club Gaming Club Machine Permit Renewal :: &pound;100.00</option>
          <option value="club-gaming-club-machine-permit-variation" >Club Gaming Club Machine Permit Variation :: &pound;50.00</option>
          <option value="club-gaming-club-machine-permit-copy" >Club Gaming Club Machine Permit Copy :: &pound;15.00</o     <---- STOPPING AT RANDOM POSITIONS

Open in new window

there are no errors in the log files or shown when "display errors" switched on. I've ruled out network issues as this does the same when logged in directly on the server via localhost.

Neil ThompsonSenior Systems DeveloperAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Ray PaseurCommented:
Some ideas, but without a hands-on demonstration it will be unlikely to pin down a solution.

What do you see with "view source?"  Is all of the HTML there?  If so, maybe there is a CSS problem

If so, try other browsers.  Do other browsers fail consistently?  

If all of the HTML is not there, the problem is likely on the server, where it did not send a complete HTML document.  Try adding output buffering to the PHP script.  It's usually as simple as adding ob_start() to the top of the script.

After that, try setting breakpoints to detect logic errors in the script.  I'm guessing that this is procedural code, but on the outside chance that it's object-oriented, consider adding PHPUnit tests to validate the behavior of all of the classes.

Liberal use of var_dump() can sometimes pick up unexpected values in the variables.

FWIW, this is not a well-understood design issue.  I've never seen a PHP script that produced a fragment of an HTML document unless it had a logic error that caused a premature exit.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Neil ThompsonSenior Systems DeveloperAuthor Commented:
Many thanks Ray

I'll give this a go. Got to admit this has stumped me so far, mostly due to the lack of any errors, anywhere.

I've even cut out chunks of the code (where it's pure HTML) and the page works, putting it back a few lines at a time works until you reach a certain amount of code (everything I'm cutting is just <select> <options>. Deleting earlier <options> then makes it work again so I know its not the HTML.

I'll try your comments above but I'm starting to think this may be more the Apache server based.

Thanks as always for your help

Ray PaseurCommented:
Might be good to set up a test bed that has nothing but HTML - no PHP, no SQL, no JavaScript, no CSS, and see if that alone can reproduce the failure.  I've never heard of a strict limit on select-options, but there may be something "under the covers" that we've never encountered before.

Do you know the exact byte count of the output document at the point of failure?
10 Tips to Protect Your Business from Ransomware

Did you know that ransomware is the most widespread, destructive malware in the world today? It accounts for 39% of all security breaches, with ransomware gangsters projected to make $11.5B in profits from online extortion by 2019.

Neil ThompsonSenior Systems DeveloperAuthor Commented:
I'll try that Ray, I was trying to work out the byte count yesterday but I'm not sure how to do that?

I tried altering the output buffering to double the standard 4096 but that had no effect last night.
Ray PaseurCommented:
For the byte count, I would use "view source" and copy / paste the result into a text editor.  Most of them can give you a document length.
Neil ThompsonSenior Systems DeveloperAuthor Commented:
Sorry for the delay in replying Ray.

Nothing seemed to give a definitive answer playing around and the count kept changing.

Seeing as there were no errors at all appearing I thought the issue may have been with Apache. Over the weekend I reinstalled exactly the same version, with the same configuration and it worked perfectly.

Weird how this has been fine for 9+ months but at least its working again now. I'll keep a closer eye on Apache from now on rather than my PHP code :)

Thanks for you help as always.

It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Apache Web Server

From novice to tech pro — start learning today.