Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6816651
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T20:57:04+00:00 2026-05-26T20:57:04+00:00

In the PHP manual for include , there is a user contribution that states

  • 0

In the PHP manual for include, there is a user contribution that states the following:

include() when used to load configuration information has a scary
security flaw, if someone corrupts the PHP header in the included file
it will happily print the config file to every page which includes it
as plain text.

Luckily there is a quick and easy workout for this behaviour (which is
alluded to in this article):

<?php
ob_start();//Hook output buffer
include("config.php");
ob_end_clean();//Clear output buffer
?> 

I know that the following will prevent any output until the output buffer is cleared/unhooked/whatever. However, what I am unsure about, is the if someone corrupts the PHP header in the included file – is that something that can be done client-side / remotely, or would that be if I accidentaly gave the php file a different file extension?

To make a long story short: How COULD an outside user corrupt the php header?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T20:57:05+00:00Added an answer on May 26, 2026 at 8:57 pm

    Ok, let’s say you’ve got a file seekritpasswords.php that you include, and it contains your database credentials. You’d have a file that looks something like:

    <?php
    
    $db_user = 'fred';
    $db_passwd = 'barney';
    $db_name = 'wilma';
    $db_host = 'betty';
    

    The php “header” is the <?php portion. If that becomes corrupted, say by adding a space to it, or removing it entirely, etc… Then the file is no longer a php script, as it does not contain the header which triggers “php mode”. it’ll just be plain text, and gets treated as regular output like any other plain text file. Remember, there’s no such thing as a PHP script. There’s only files which contain one or more PHP blocks, and those blocks are delimited by <?php ?> tag sets.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

From perusing the comments at http://php.net/manual/en/function.set-include-path.php , it seems to me that '.', or
Is there a .dll version of the inclued extension for PHP ? The manual's
I have the following piece of code taken from the PHP manual on the
What does the following code do? A link to something in the PHP manual
There is not too much information in the PHP APC documentation about filtering files.
There are plenty of examples of both on the web. The php manual says
http://www.php.net/manual/en/features.remote-files.php The only time I could ever think of doing include( http://someotherserver/foo.php ) would
I have a following code: <?php include(config.php); $key = 'blahblah'; $sql = INSERT INTO
I wanted to try out an example you can find here: http://php.net/manual/en/function.include.php , but
In the PHP manual, to show the syntax for functions with optional parameters, they

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.