Custom 404 PHP page ignored (RESOLVED)

 
Post new topic   Reply to topic    Aprelium Forum Index -> General Questions
View previous topic :: View next topic  
Author Message
Lawrence
-


Joined: 16 Jan 2003
Posts: 207
Location: Brisbane, AU

PostPosted: Fri Jun 12, 2009 2:39 am    Post subject: Custom 404 PHP page ignored (RESOLVED) Reply with quote

(UPDATE: All fixed. For PHP versions later than 5.2.4, STANDARD TYPE should be used, not PHP TYPE.)

I have a weird question that a user just brought to my attention.

I serve a half dozen domains and rely on a 404.PHP file to serve up useful errors to users. Today I've been told, and have confirmed, that NONE of my 404.PHP for ANY domain will work. Instead, the generic Abyss 404 page is being shown.

Did I miss the memo where it was explained that PHP files can't be used for 404s? I mean, I've been using them for YEARS and they always WORKED. Now they're being skipped right over...

What's up with this?


Last edited by Lawrence on Wed Jun 24, 2009 2:15 am; edited 1 time in total
Back to top View user's profile Send private message Visit poster's website ICQ Number
aprelium-support
-


Joined: 20 Feb 2009
Posts: 356

PostPosted: Fri Jun 12, 2009 9:50 am    Post subject: Re: Custom 404 PHP page ignored Reply with quote

Lawrence,

PHP files can be used for 404 error pages.

Did you try to browse your 404.php file from its direct link ?

Try to replace your script with this simple one:

Code:
<?php
   phpinfo();
?>


Is it working ?
_________________
Support Team
Aprelium - http://www.aprelium.com
Back to top View user's profile Send private message Visit poster's website
Lawrence
-


Joined: 16 Jan 2003
Posts: 207
Location: Brisbane, AU

PostPosted: Fri Jun 12, 2009 3:27 pm    Post subject: Re: Custom 404 PHP page ignored Reply with quote

aprelium-support wrote:
Did you try to browse your 404.php file from its direct link ?


If I navigate directly to it, there are no problems. The file is found and the PHP works.

Copied from the config page:

Code:
404 - Not Found   /system/404.php


The following URL works:

http://domain.com/system/404.php

But if I enter a non-existent path, the 404 error page is Abyss' own.
Back to top View user's profile Send private message Visit poster's website ICQ Number
aprelium-support
-


Joined: 20 Feb 2009
Posts: 356

PostPosted: Fri Jun 12, 2009 3:57 pm    Post subject: Reply with quote

Please make sure again that your associated urls are correct.

For example, try this configuration:

Code:
404 - Not Found  http://domain.com/system/404.php


If you’re still experiencing problems, send your abyss.conf and php script to the support team:

http://www.aprelium.com/support/email/
_________________
Support Team
Aprelium - http://www.aprelium.com
Back to top View user's profile Send private message Visit poster's website
Lawrence
-


Joined: 16 Jan 2003
Posts: 207
Location: Brisbane, AU

PostPosted: Sat Jun 13, 2009 11:40 am    Post subject: Reply with quote

Well, since changing the file to 404.htm works fine, I'm pretty sure the error is not with this part of the configuration. Wherever the failure is, it's not here.

I didn't realize a full URL could be used for the error pages. I'll give that a go. (UPDATE: yes, that seems to have fixed it. What might be the cause? What should I check?

Now, unfortunately, the 301 redirect I used to use no longer works.

This code:

Code:
<?
   $newuri = $_SERVER['REQUEST_URI'];
   header("Status: 301 Moved Permanently");
   header("Location: http://newdomain.com$newuri");
   exit;
?>


used to elegantly redirect to the new site (the domain name was all that changed, requiring the redirect).

Now it seems the $newuri = the 404 page itself, not the original request.

It's really puzzling, 'cause all of this used to work really well. It's weird that both the page itself and the request_uri started going strange at the same time.

Any ideas what I should be checking?
Back to top View user's profile Send private message Visit poster's website ICQ Number
Lawrence
-


Joined: 16 Jan 2003
Posts: 207
Location: Brisbane, AU

PostPosted: Thu Jun 18, 2009 10:25 am    Post subject: Reply with quote

Still beating my head against this problem.

I went through every single config option for this domain, and basically - since it's only used to redirect - everything's blank/default except for the 404 page and the PHP setup.

There's a 404.php in /system/
If I use the URL: domain.com/system/404.php then I can view the page (and the PHP works).
The 404 custom page is set to /system/404.php. Please remember, this was working fine for a long time.

Now, for reasons I cannot figure out, if I enter a bogus path, I get Abyss' 404 page. The custom page is completely ignored.

If I change the 404.php to 404.htm (and configure Abyss to use it) then everything works fine, the new 404 page is shown when a bogus URL is requested.

Basically, the instant I change 404.htm to 404.php, Abyss refuses to display it. That means the paths are all correct and Abyss is properly recognizing and using the custom 404 document.
Back to top View user's profile Send private message Visit poster's website ICQ Number
Lawrence
-


Joined: 16 Jan 2003
Posts: 207
Location: Brisbane, AU

PostPosted: Thu Jun 18, 2009 12:41 pm    Post subject: Reply with quote

Update: For the purposes of testing, I stopped Abyss and gutted the abyss.conf file, removing all but one domain config. No matter which one I left, no 404.php would be shown when a non-existent URL was requested.

This leads me to one conclusion: Either there's a bug in the software itself (which is weird, 'cause as I say, it USED TO WORK) or..

Somewhere, and I have no idea where, the abyss.conf file is instructing the server to not serve the 404.php file. This is, quite frankly, bizarre.
Back to top View user's profile Send private message Visit poster's website ICQ Number
Lawrence
-


Joined: 16 Jan 2003
Posts: 207
Location: Brisbane, AU

PostPosted: Fri Jun 19, 2009 12:53 pm    Post subject: Reply with quote

I completely nuked the abyss.conf file tonight, removing EVERYTHING but the X2 key. I then pasted in a domain that has basically no config but the PHP setup, and the custom 404 page.

The 404.PHP page was ignored, and replaced with Abyss' own page. This was the same case for EVERY domain.

ALL PHP error pages are ignored: the 403.PHP page is ignored, but if I replace it with 403.HTM it works fine. Same for the 401 page - HTM works, PHP is skipped and replaced with the Abyss page.

Now, there has to be a reason for this, but I have no idea what it could be. Abyss' page does not say if it can find the 404.PHP page or not (Apache says something like "The page you wanted does not exist. Additionally, no error page could be found.").

Please, any help is appreciated. If the problem doesn't come from the abyss.conf file, it could come from some other component of the server, right? Problem is, I have no idea what could come between Abyss (which serves up real PHP pages without complaint) and the error pages.
Back to top View user's profile Send private message Visit poster's website ICQ Number
Lawrence
-


Joined: 16 Jan 2003
Posts: 207
Location: Brisbane, AU

PostPosted: Sat Jun 20, 2009 12:01 pm    Post subject: Reply with quote

More clues:

If I rename the 404 file to 404.php5, it works fine (but is just a regular HTML file).

As soon as I tell Abyss that the PHP5 extension should be interpreted by PHP, it fails to be shown and Abyss uses its own error page instead.

So it's not a missing file problem, it seems that Abyss is refusing to serve _ANY_ PHP-interpreted file, regardless of name.

Also, to be clear, the problem is server wide, it is not a problem with one domain, which rules out URL rewrites or aliases as part of the problem.


Last edited by Lawrence on Sat Jun 20, 2009 12:05 pm; edited 1 time in total
Back to top View user's profile Send private message Visit poster's website ICQ Number
Lawrence
-


Joined: 16 Jan 2003
Posts: 207
Location: Brisbane, AU

PostPosted: Sat Jun 20, 2009 12:02 pm    Post subject: Reply with quote

Sorry about the double post, got an error 500 while posting. =)
Back to top View user's profile Send private message Visit poster's website ICQ Number
Lawrence
-


Joined: 16 Jan 2003
Posts: 207
Location: Brisbane, AU

PostPosted: Sun Jun 21, 2009 10:13 am    Post subject: Reply with quote

I discovered today that one of the domains I run has had something strange happen. Images that are referenced like this:

images/arrow.gif

which SHOULD result in this:

domain.com/directory/images/arrow.gif

are being shown to the browser like this:

domain.com/directory/index.php/images/arrow.gif

How did that index.php get in there? It's happening to more than one domain, and has basically broken a forum, where every button now leads to a function interrupted by an extraneous index.php in the URL.

I'm getting really frustrated now, not only can I not pinpoint a moment when it started, I can't even imagine a way it COULD happen. Is it a PHP setting? Is Abyss breaking down? Seriously ready to pave over the whole server and build it again if I can't figure this out.

Any help would be greatly, hugely appreciated.
Back to top View user's profile Send private message Visit poster's website ICQ Number
Lawrence
-


Joined: 16 Jan 2003
Posts: 207
Location: Brisbane, AU

PostPosted: Mon Jun 22, 2009 3:03 am    Post subject: Reply with quote

Another clue: A script that relied on PHP to sort out its own location has broken. A script that used to rely on this code:

Code:
function rooturl(){
   $dir = dirname($_SERVER['PHP_SELF']);
   if (strlen($dir) > 1) $dir.="/";

   return "http://".$_SERVER['HTTP_HOST'].$dir;
}


is now producing the bad URL:

http:/domain.com/dir/script.php/dir/image.gif

It seems that it USED TO produce the correct URL:

http:/domain.com/dir/image.gif

(note that I removed one / in http:// in the address to prevent auto-highlighting)

I don't remember doing it, but perhaps I upgraded PHP to a version that breaks this behaviour? Currently I'm using PHP Version 5.2.9-1, where the latest Aprelium package is 5.2.8, according to the downloads page.

UPDATE: possibly related to this PHP bug that only affects CGI PHP under Win32 (but was fixed in 2007...?)
Back to top View user's profile Send private message Visit poster's website ICQ Number
Lawrence
-


Joined: 16 Jan 2003
Posts: 207
Location: Brisbane, AU

PostPosted: Mon Jun 22, 2009 3:42 am    Post subject: Reply with quote

UPDATE!!

Thanks to a friend, the problem was finally eradicated when he suggested I change the TYPE from PHP STYLE to STANDARD in Abyss' PHP scripting configuration.

So it's all fixed: all my sites work again, all my error pages work again.

----

What the freaking hell made it break in the first place, is what I want to know. It's been working for YEARS.

Any ideas?
Back to top View user's profile Send private message Visit poster's website ICQ Number
TRUSTAbyss
-


Joined: 29 Oct 2003
Posts: 3752
Location: USA, GA

PostPosted: Mon Jun 22, 2009 5:27 am    Post subject: Reply with quote

Lawrence wrote:
UPDATE!!
What the freaking hell made it break in the first place, is what I want to know. It's been working for YEARS.

Any ideas?


The newest PHP versions no longer work with the PHP fix Aprelium made for Abyss Web Server. You should choose Standard for Type from now on when configuring PHP for Abyss Web Server.
Back to top View user's profile Send private message Visit poster's website
Lawrence
-


Joined: 16 Jan 2003
Posts: 207
Location: Brisbane, AU

PostPosted: Tue Jun 23, 2009 6:22 am    Post subject: Reply with quote

I went back to old versions of PHP to no avail. Even with 5.2.8 (the last version available from Aprelium) the installation instructions still say I should use PHP-Style.
Back to top View user's profile Send private message Visit poster's website ICQ Number
Toasty
-


Joined: 21 Feb 2008
Posts: 298
Location: Chicago, IL

PostPosted: Tue Jun 23, 2009 4:36 pm    Post subject: Reply with quote

Edit?
_________________
Audit the secure configuration of your server headers!
Back to top View user's profile Send private message Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic    Aprelium Forum Index -> General Questions All times are GMT + 1 Hour
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB phpBB Group