PDA

View Full Version : PHP- include code parsing failure



Kyro
January 13th, 2005, 13:03
This issue has been resolved. Thank you for all of your assistance!

Go to www.dementedminds.org. You can see for yourself that the site is vomiting like crazy. Basically, the index php file includes functions.php file, and that's where it pukes like crazy.

This is index.php:


<?
# Initalize Session if it exists
#-------------

session_start();

# Include essential files
#-------------

include 'functions.php';
include 'db.php';
include 'datetime.php';
include 'xds711/essentials.dm';

# Block out unwelcome visitors
#-------------

ipbanchk("total");

# Check to see if visitor has already logged in
#-------------

loginchk("y");

# Do login check, also check theme if logged in
#-------------

$theme = "themes/default";

# Surpress code is in place to prevent a HEADER ALREADY SENT error.
#-------------

$surpress = $_REQUEST['surpress'];
if($surpress != "true"){
?>
<html>
<head>
<title>Welcome to the Demented Minds Domain!</title>
</head>
<body topmargin="0" leftmargin="0" rightmargin="0">
<?
include "$theme/header.dm";
$op = $_REQUEST['op'];
if($op == "") $op = "news.php";
include $op;
include "$theme/footer.dm";
} else {
$op = $_REQUEST['op'];
if($op == "") $op = "news.php";
include $op;
}

#-------------
# End of main script.
#-------------
?>


As for functions.php, well just go to www.dementedminds.org, right click on the page, and click on view source. It'll show the script. Obviously it's being parsed as HTML. Now, if you examine functions.php, you can see it starts and ends with <? and ?>. So it should be parsed as php. I've tried removing those tags, changing <? to <?php, even placing functions.php into a seperate directory, changing include 'functions.php'; to include "functions.php";, include('functions.php');, and include("functions.php");.

I tested to see if it was parsing as html by adding html at the start of functions.php, the browser correctly parsed that as html code, but when it hit the <? tag, it did not recognize that and kept processing it as html. It's driving me insane, and I've been searching the entire archives, cached and uncached, of google.com for a solution- none of the solutions solved my problem. I'm at the point where I want to rip this pc apart, shred the monitor into itty bitty pieces, and simply go screaming into the woods like a madman. I tried contacting my host to see if he could help, but he's nowhere to be found- I've sent him two emails, no response. HELP!!!!!!!

CAWUnited.com
January 13th, 2005, 20:37
take a look at your .htaccess file and see if there are any lines like " AddType application/x-httpd-php ", or any AddType statements. Maybe it is set to not parse .php files as php. try adding AddType application/x-httpd-php .php .php3 to the .htaccess file.

Kyro
January 14th, 2005, 10:40
My host finally answered my email. He says somehow the headers for the functions.php file got corrupted during transfer from the upper level directory to the root directory, so the server was mis-reading it. He reset the headers back text headers, and also tried to weed out the minor corruptions throughout the file that resulted from the transfer. Before he did that, he made a copy of the file, named that copy old_functions.php. Whatever changes he made, the site seems to be functional now.

http://www.dementedminds.org

As you can see, whatever he did, it fixed the problem. Now here's what I don't get: I opened functions.php on my computer, checked the header- it seems clean. But hey, if it works, don't complain, right? I just wish I knew exactly what he was talking about so I could fix it myself next time. I'm not a newbie, but I ain't a master either. So I'm always up to learning stuff.

Thanks for all your help!