Problems with PHP

April 27, 2007 2:36 AM | Comments (8)

Dear readers,

Yesterday my blog went blank. I thought I had again exceeded my file storage space, but on checking, there was plenty of space left.

I thought I had exceeded my bandwidth, seeing how my account went over 5GB so far, this month. But the web host assured me that was not the problem.

My blog did receive over 1,500 cases of trackback spam, which took a very long time to delete, but it made no difference. (I didn't expect it to, but it was a wild hope)

My web host said it was a problem with my S-Code capcha plugin for Movable Type, but I realised it wasn't just my blog pages but any PHP pages using @include files. I tried using another version of 'include' code but that made no difference. Any text appearing after the very first line of @include code, would simply not display.

I then got suspicious as I had not touched my Movable Type plugins or templates recently. I asked my web host if they had recently upgraded their version of PHP. The answer was yes. I read up on the latest documentation involving the 'include' command but haven't quite put my finger on what the problem is. Do you have any idea?

This is how I encase my include files:
<?php @include("<MTBlogURL>includes/header.php"); ?>

It worked fine until, presumably, the upgrade to PHP 4.4.6.

At least, I managed to narrow it down and sure enough, as I substituted the @include links with the original lines of code, things started appearing again. This home page, which some of you might be viewing right now, is working simply because of this.

But this is only a quick fix. I need to figure out the PHP problem as I still want to use 'include' files for better control of my code. If you guys know a workaround, please let me know! Thanks.

[Of course, for you guys to reply, I have to 'quick-fix' my individual blog post template as well, so it no longer calls on 'include' files. Sigh. I'm only going to re-publish recent posts for now, so at least you don't see blank pages.]

Recent entries

8 Comments

Testing. I'm getting paranoid now that other parts of my website don't work. Then there's the capcha issue.

Try removing the @ from the beginning of the include command:

Okay, so that didn't work.

Do you need the variable? Could you try it without that and make it an absolute reference from the top of your directory structure?

Removing the @ should help.

hardly noticed, but then I read you on rss!

Good to see you the other week. Sorry that it was so appallingly short - I think I spent the whole day shaking hands with a gazillion people and having 20 second conversations nevertheless I appreciated you making the effort to say hello.

Basic include syntax would be

include 'my_include_file.php';

or

include "my_include_file.php";

for both PHP4 and PHP5.

Do you have access to your error logs?

Another place to check is the file that you are including. Make sure they have valid PHP start and end tags.

Just to clarify what I meant by removing the variable, the MTBlogURL bit expands to http://www.vantan.org/, making your include statement read

include ("http://www.vantan.org/includes/header.php")

You probably don't want that; you want to include it directly from the file system:

include("/includes/header.php")

Hi guys,

Thank you so much for your help.

Turns out that I had to remove the "@ include" portion, as well as make a reference to the absolute path within my server. Once I did that, everything worked fine again.

Really strange as I recall having to use the "@" sign to fix some other problem when my previous web host upgraded their version of PHP. Oh well. A new lesson learnt.

Subscribe to my feed

Feedburner

About this Entry

This page contains a single entry by vantan published on April 27, 2007 2:36 AM.

Al Dented was the previous entry in this blog.

It's election time again is the next entry in this blog.

Find recent content on the main index or look in the archives to find all content.

On Twitter...