Custom Error Pages weirdness

 
Post new topic   Reply to topic    Aprelium Forum Index -> PHP
View previous topic :: View next topic  
Author Message
loloyd
-


Joined: 03 Mar 2006
Posts: 435
Location: Philippines

PostPosted: Tue May 30, 2006 12:05 pm    Post subject: Custom Error Pages weirdness Reply with quote

I am having problems with my office setup. I don't know where the difference lies but I already had this working at my home setup. I have the same Abyss 2.3.0.5 version at home and here in my office PC. The PHP version I have here in the office is 5.0.3, while it's also 5.x.x at home (hehehe will have to get this info when I get home). Nothing seems to be amiss in abyss.conf.

For some reason, setting a Custom 404 Error Page to a php handler would not commit, i.e. Abyss' standard error 404 is being displayed.
Quote:
Error 404

Not Found

Powered by Abyss Web Server X1
© Aprelium Technologies - 2001-2006
But if I post a gif or htm handler, the Custom 404 Error Page works! Compounding the confusion is that I am INDEED able to run php pages here with no apparent problems at all! I've tried setting the handler to my own custom url_rewrite.php and then some stock php like phpinfo.php (implied content) or webfilebrowser.php (implied content) - they each won't work as a Custom 404 Error Page! But if I put in a gif or an htm file, it works! And the webserver can in fact read phpinfo.php and webfilebrowser.php if I requested them directly.

What's going on? What kind of technical voodoo is this? It's gotten me dazed and confused. Can anybody shed some light on this?

Update: I have now been able to replicate the problem on another office machine. This doesn't seem to be an isolated quirk.
_________________

http://home.loloyd.com/ is online if the logo graphic at left is showing.
Back to top View user's profile Send private message Visit poster's website
loloyd
-


Joined: 03 Mar 2006
Posts: 435
Location: Philippines

PostPosted: Wed May 31, 2006 7:43 am    Post subject: Reply with quote

I'm beginning to think that this is not a PHP problem but could well be a server problem. Here are the responses of Abyss for:

404 redirected to a GIF file:
Code:
HTTP/1.1 404 Not Found
Content-Type: image/gif
Content-Length: 73
Last-Modified: Tue, 23 May 2006 05:23:35 GMT
Connection: Close
Date: Wed, 31 May 2006 06:32:10 GMT
Server: Abyss/2.3.0.5-X1-Win32 AbyssLib/2.3.0.5

GIF89a►
       æ┴┴┴ ☺☺ ∙♦☺♥,►
                     ☻£Åi┴▌║∟âGR⌠î╕#∟☺r^ΣI¥¬¿¶;

Connection to host lost.

404 redirected to an HTML file:
Code:
HTTP/1.1 404 Not Found
Content-Type: text/html
Content-Length: 80
Last-Modified: Wed, 31 May 2006 06:41:01 GMT
Connection: Close
Date: Wed, 31 May 2006 06:41:48 GMT
Server: Abyss/2.3.0.5-X1-Win32 AbyssLib/2.3.0.5

<html>
Custom 404 error.
The resource you requested does not exist.
</html>


Connection to host lost.

404 redirected to ANY PHP file:
Code:
HTTP/1.1 404 Not Found
Content-Type: text/html
Content-Length: 403
Connection: Close
Date: Wed, 31 May 2006 06:33:14 GMT
Server: Abyss/2.3.0.5-X1-Win32 AbyssLib/2.3.0.5

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.or
g/TR/html4/loose.dtd"><HTML><HEAD><META HTTP-EQUIV='Content-Type' CONTENT='text/
html; charset=utf-8'><TITLE>Error 404</TITLE></HEAD><BODY><H1>Error 404</H1><P>N
ot Found</P><p><HR>Powered by <b><i>Abyss Web Server</i></b> X1<br>&copy; <a hre
f="http://www.aprelium.com">Aprelium Technologies</a> - 2001-2006</p></BODY></HT
ML>

Connection to host lost.

_________________

http://home.loloyd.com/ is online if the logo graphic at left is showing.


Last edited by loloyd on Thu Jun 01, 2006 5:23 pm; edited 1 time in total
Back to top View user's profile Send private message Visit poster's website
aprelium
-


Joined: 22 Mar 2002
Posts: 6800

PostPosted: Wed May 31, 2006 10:22 am    Post subject: Reply with quote

loloyd wrote:
404 redirected to a PHP file:
Code:
HTTP/1.1 404 Not Found
Content-Type: text/html
Content-Length: 403
Connection: Close
Date: Wed, 31 May 2006 06:33:14 GMT
Server: Abyss/2.3.0.5-X1-Win32 AbyssLib/2.3.0.5

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.or
g/TR/html4/loose.dtd"><HTML><HEAD><META HTTP-EQUIV='Content-Type' CONTENT='text/
html; charset=utf-8'><TITLE>Error 404</TITLE></HEAD><BODY><H1>Error 404</H1><P>N
ot Found</P><p><HR>Powered by <b><i>Abyss Web Server</i></b> X1<br>&copy; <a hre
f="http://www.aprelium.com">Aprelium Technologies</a> - 2001-2006</p></BODY></HT
ML>

Connection to host lost.


This error means that Abyss Web Server was unable to find the PHP file you wanted it to run when an error occurs. Check that the virtual path you've set for the PHP custom error script is correct: the easiest way is to browse it directly. Or if you have trouble setting it, press the Browse button next to the Virtual Path field (in the Custom error screen) to locate it.
_________________
Support Team
Aprelium - http://www.aprelium.com
Back to top View user's profile Send private message Send e-mail
loloyd
-


Joined: 03 Mar 2006
Posts: 435
Location: Philippines

PostPosted: Thu Jun 01, 2006 4:02 am    Post subject: Reply with quote

Sadly, I did use the Browse button in my tests above. And my PHP pages do work if browsed directly.
_________________

http://home.loloyd.com/ is online if the logo graphic at left is showing.
Back to top View user's profile Send private message Visit poster's website
aprelium
-


Joined: 22 Mar 2002
Posts: 6800

PostPosted: Thu Jun 01, 2006 11:49 am    Post subject: Reply with quote

loloyd wrote:
Sadly, I did use the Browse button in my tests above. And my PHP pages do work if browsed directly.

Can you please post the PHP page source code here? Can try using a very simple PHP page and see if it makes any difference?
_________________
Support Team
Aprelium - http://www.aprelium.com
Back to top View user's profile Send private message Send e-mail
loloyd
-


Joined: 03 Mar 2006
Posts: 435
Location: Philippines

PostPosted: Fri Jun 02, 2006 3:29 am    Post subject: Reply with quote

PHP filecodes that have been tested, and failed:

Filename: phpinfo.php
Code:
<?php
    phpinfo();
?>

Filename: webfilebrowser.php
Code:
<?php
//======================================================================
// Name        : Web File Browser
// Description : A web-based file browser written in PHP
// HomePage    : http://www.webfilebrowser.org/
// Author      : David AZOULAY (cgdave@wanadoo.fr)
<... snipped for brevity, the point is it's the same webfilebrowser code ...>
?>

Filename: url_rewrite.php
Code:
<?php
/* Add in this array the list of (old path => new path) pairs */
$redirection = array(
   '^(.*)$' => 'index.php?q=$1'
);
/*   '^wiki/?(.*)$' => '/w/index.php?title=$1' */
if (!file_exists($_SERVER["REDIRECT_SCRIPT_NAME"]))
/* Get the URI and trim leading slashes */
$uri = ltrim($_SERVER["REDIRECT_SCRIPT_NAME"], "/");
{
foreach ($redirection as $key => $value)
{
   if (eregi($key, $uri))
   {
        /* Convert the replacement string syntax - $1 -> \1 */
        /* and perform the substitution */
      $new_uri = eregi_replace($key, str_replace("$", "\\", $value), $uri);
      $new_uri = "/index.php?q=".$uri;
      $new_uri = "/index.php?q=".str_replace("index.php","",substr($uri,0));
      $new_uri = str_replace("%26","&",$new_uri);
      break;
   }
}
}
if (isset($new_uri))
{
   header("Status: 307");
   header("Location: $new_uri");
   exit;
}
?>
<!-- Your 404 error page -->
<HTML>
<HEAD>
<TITLE>Not Found</TITLE>
</HEAD>
<BODY>
The object <tt><?php echo $uri; ?></tt> is not available.
</BODY>
</HTML>

_________________

http://home.loloyd.com/ is online if the logo graphic at left is showing.
Back to top View user's profile Send private message Visit poster's website
aprelium
-


Joined: 22 Mar 2002
Posts: 6800

PostPosted: Fri Jun 02, 2006 11:02 am    Post subject: Reply with quote

loloyd,

Can you please send us your abyss.conf file? Please do not forget to include a reference to this forum message in your email.
_________________
Support Team
Aprelium - http://www.aprelium.com
Back to top View user's profile Send private message Send e-mail
loloyd
-


Joined: 03 Mar 2006
Posts: 435
Location: Philippines

PostPosted: Mon Jun 05, 2006 7:06 am    Post subject: Reply with quote

Copy of abyss.conf sent. Thanks.
_________________

http://home.loloyd.com/ is online if the logo graphic at left is showing.
Back to top View user's profile Send private message Visit poster's website
loloyd
-


Joined: 03 Mar 2006
Posts: 435
Location: Philippines

PostPosted: Fri Jun 23, 2006 8:08 am    Post subject: Reply with quote

This problem was solved when I installed Aprelium's pre-packaged PHP5 found at http://www.aprelium.com/abyssws/php5win.html. Therefore, the problem must lie within PHP 5.0.3, or somewhere in my package copy.

There appears to be something amiss in my former php.ini. I shall try to identify the relevant differences between that and Aprelium's php.ini.
_________________

http://home.loloyd.com/ is online if the logo graphic at left is showing.
Back to top View user's profile Send private message Visit poster's website
aprelium
-


Joined: 22 Mar 2002
Posts: 6800

PostPosted: Fri Jun 23, 2006 1:16 pm    Post subject: Reply with quote

loloyd,

Thank you for your update. We were unable to reproduce the problem hence our "silence".

Could you please do the comparison and let us know what were the differences?
_________________
Support Team
Aprelium - http://www.aprelium.com
Back to top View user's profile Send private message Send e-mail
loloyd
-


Joined: 03 Mar 2006
Posts: 435
Location: Philippines

PostPosted: Tue Jun 27, 2006 9:27 am    Post subject: Reply with quote

I have tried two approaches but, sadly, I am unable to determine where the significant differences in the php.ini settings lie. The first approach was to configure each individual ini setting from the 5.1.4 to 5.0.3; and the second is only vice versa. There may very well be a combination of ini settings that I was not able to test. (Incidentally, my Drupal website wouldn't run on Aprelium's packaged PHP 5.1.4 - isn't this just a lovely chronic troubleshooter's dream?).

Barring any sound intelligent solution, my quick and ugly fix was to install 5.1.4 in C:\Program Files\PHP5 and let my original 5.0.3 remain intact in C:\PHP. I therefore copied exactly the same rewrite file url_rewrite.php onto url_rewrite.php5. Finally, I set PHP 5.1.4 to handle files with a .php5 extension, yet leaving the envar PHPRC pointing C:\PHP. Of course, I had to declare url_rewrite.php5 as my new 404 error handler.

Dirty? Yes. Sound? No. But it solves all problems. Drupal works. URL rewrite works. Cost: around 20 megs of disk space.

Here are the notable differences in the directive
FC "C:\Program Files\PHP5\php.ini" "C:\PHP\php.ini"
(private settings have been removed)
Code:
Comparing files C:\PROGRAM FILES\PHP5\php.ini and C:\PHP\PHP.INI

***** C:\PROGRAM FILES\PHP5\php.ini
precision    =  14
***** C:\PHP\PHP.INI
precision    =  12
*****

***** C:\PROGRAM FILES\PHP5\php.ini
output_buffering = 4096
***** C:\PHP\PHP.INI
output_buffering = Off
*****

***** C:\PROGRAM FILES\PHP5\php.ini
allow_call_time_pass_reference = Off
***** C:\PHP\PHP.INI
allow_call_time_pass_reference = On
*****

***** C:\PROGRAM FILES\PHP5\php.ini
safe_mode_gid = Off
***** C:\PHP\PHP.INI
safe_mode_gid = On
*****

***** C:\PROGRAM FILES\PHP5\php.ini
max_execution_time = 30     ; Maximum execution time of each script, in seconds
max_input_time = 60     ; Maximum amount of time each script may spend parsing request data
memory_limit = 8M      ; Maximum amount of memory a script may consume (8MB)
***** C:\PHP\PHP.INI
max_execution_time = 300     ; Maximum execution time of each script, in seconds, original 60
max_input_time = 150 ; Maximum amount of time each script may spend parsing request data, original 60
memory_limit = 16M      ; Maximum amount of memory a script may consume (8MB)
*****


***** C:\PROGRAM FILES\PHP5\php.ini
error_reporting  =  E_ALL & ~E_NOTICE
***** C:\PHP\PHP.INI
error_reporting  = E_ALL
*****

***** C:\PROGRAM FILES\PHP5\php.ini
log_errors = On
***** C:\PHP\PHP.INI
log_errors = Off
*****

***** C:\PROGRAM FILES\PHP5\php.ini
;html_errors = Off
***** C:\PHP\PHP.INI
html_errors = Off
*****

***** C:\PROGRAM FILES\PHP5\php.ini
variables_order = "GPCS"
***** C:\PHP\PHP.INI
variables_order = "EGPCS"
*****

***** C:\PROGRAM FILES\PHP5\php.ini
register_globals = On
***** C:\PHP\PHP.INI
register_globals = Off
*****

***** C:\PROGRAM FILES\PHP5\php.ini
register_argc_argv = Off
auto_globals_jit = On
***** C:\PHP\PHP.INI
register_argc_argv = On
*****

***** C:\PROGRAM FILES\PHP5\php.ini
magic_quotes_gpc = Off
***** C:\PHP\PHP.INI
magic_quotes_gpc = On
*****

***** C:\PROGRAM FILES\PHP5\php.ini
;always_populate_raw_post_data = On
***** C:\PHP\PHP.INI
always_populate_raw_post_data = On
*****

***** C:\PROGRAM FILES\PHP5\php.ini
;include_path = ".;c:\php\includes"
***** C:\PHP\PHP.INI
include_path = ".;c:\php"
*****

***** C:\PROGRAM FILES\PHP5\php.ini
extension_dir =C:\Program Files\PHP5
***** C:\PHP\PHP.INI
extension_dir = "C:\php\ext\"
*****

***** C:\PROGRAM FILES\PHP5\php.ini
cgi.force_redirect = 0
cgi.fix_pathinfo = 1
***** C:\PHP\PHP.INI
cgi.force_redirect = 0
*****

***** C:\PROGRAM FILES\PHP5\php.ini
; fastcgi.impersonate = 1;
; fastcgi.log = 0
***** C:\PHP\PHP.INI
fastcgi.impersonate = 1
*****

***** C:\PROGRAM FILES\PHP5\php.ini
upload_max_filesize = 2M
***** C:\PHP\PHP.INI
upload_max_filesize = 8M
*****

***** C:\PROGRAM FILES\PHP5\php.ini
extension=php_mbstring.dll
;extension=php_bz2.dll
***** C:\PHP\PHP.INI
extension=php-5.0.4_magickwand_q8_st.dll
;extension=php_bz2.dll
*****

***** C:\PROGRAM FILES\PHP5\php.ini
extension=php_mysql.dll
extension=php_mysqli.dll
***** C:\PHP\PHP.INI
extension=php_mysql.dll
*****

***** C:\PROGRAM FILES\PHP5\php.ini
;extension=php_sockets.dll
extension=php_sqlite.dll
;extension=php_sybase_ct.dll
***** C:\PHP\PHP.INI
;extension=php_sockets.dll
;extension=php_sybase_ct.dll
*****

***** C:\PROGRAM FILES\PHP5\php.ini
;extension=php_xsl.dll
extension=php_pdo.dll
;extension=php_pdo_firebird.dll
;extension=php_pdo_informix.dll
;extension=php_pdo_mssql.dll
extension=php_pdo_mysql.dll
;extension=php_pdo_oci.dll
;extension=php_pdo_oci8.dll
extension=php_pdo_odbc.dll
;extension=php_pdo_pgsql.dll
extension=php_pdo_sqlite.dll

***** C:\PHP\PHP.INI
;extension=php_xsl.dll
;extension=php_yaz.dll
;extension=php_zip.dll
*****

***** C:\PROGRAM FILES\PHP5\php.ini
[bcmath]
***** C:\PHP\PHP.INI
[dbx]
dbx.colnames_case = "unchanged"
[bcmath]
*****

***** C:\PROGRAM FILES\PHP5\php.ini
session.gc_probability = 1
session.gc_divisor     = 1000
***** C:\PHP\PHP.INI
session.gc_probability = 1
session.gc_divisor     = 100
*****

***** C:\PROGRAM FILES\PHP5\php.ini
session.bug_compat_42 = 0
session.bug_compat_warn = 1
***** C:\PHP\PHP.INI
session.bug_compat_42 = 1
session.bug_compat_warn = 1
*****

***** C:\PROGRAM FILES\PHP5\php.ini
session.hash_bits_per_character = 5
***** C:\PHP\PHP.INI
session.hash_bits_per_character = 4
*****

***** C:\PROGRAM FILES\PHP5\php.ini
url_rewriter.tags = "a=href,area=href,frame=src,input=src,form=fakeentry"
***** C:\PHP\PHP.INI
url_rewriter.tags = "a=href,area=href,frame=src,input=src,form=,fieldset="
session.save_path= C:\PHP\sessiondata    ; argument passed to save_handler
*****

***** C:\PROGRAM FILES\PHP5\php.ini
[Verisign Payflow Pro]
***** C:\PHP\PHP.INI
[Ingres II]
; Allow or prevent persistent links.
ingres.allow_persistent = On
; Maximum number of persistent links.  -1 means no limit.
ingres.max_persistent = -1
; Maximum number of links, including persistents.  -1 means no limit.
ingres.max_links = -1
; Default database (format: [node_id::]dbname[/srv_class]).
ingres.default_database =
; Default user.
ingres.default_user =
; Default password.
ingres.default_password =
[Verisign Payflow Pro]
*****

***** C:\PROGRAM FILES\PHP5\php.ini
[COM]
; path to a file containing GUIDs, IIDs or filenames of files with TypeLibs
***** C:\PHP\PHP.INI
[Sockets]
; Use the system read() function instead of the php_read() wrapper.
sockets.use_system_read = On
[com]
; path to a file containing GUIDs, IIDs or filenames of files with TypeLibs
*****

_________________

http://home.loloyd.com/ is online if the logo graphic at left is showing.


Last edited by loloyd on Tue Jun 27, 2006 9:31 am; edited 1 time in total
Back to top View user's profile Send private message Visit poster's website
loloyd
-


Joined: 03 Mar 2006
Posts: 435
Location: Philippines

PostPosted: Tue Jun 27, 2006 9:39 am    Post subject: Reply with quote

OR, this might just well be another classic case of PEBKAC.
_________________

http://home.loloyd.com/ is online if the logo graphic at left is showing.
Back to top View user's profile Send private message Visit poster's website
aprelium
-


Joined: 22 Mar 2002
Posts: 6800

PostPosted: Tue Jun 27, 2006 1:38 pm    Post subject: Reply with quote

loloyd,

Many thanks for the very detailed report. It will help us track this weird behavior.

PHP 5.0.x and PHP 5.1.y have several internal differences which could explain what you have experienced.

PHP 5.1.4 should also work fine with Drupal. It is probably one of the php.ini parameters related to the prefilled variables that is not compatible with your current setup of Drupal.
_________________
Support Team
Aprelium - http://www.aprelium.com
Back to top View user's profile Send private message Send e-mail
loloyd
-


Joined: 03 Mar 2006
Posts: 435
Location: Philippines

PostPosted: Wed Jun 28, 2006 2:31 am    Post subject: Reply with quote

Hmm... the curiosity remains. I have no idea how Abyss executes a script via a pre-declared PHP interpreter, all the while passing also the required HTTP parameters and variables (to/from STDIO?). And I wonder why, when given only a single PHP interpreter, a 404 handler would behave differently as opposed to requesting the URI directly.

One thing for sure is that this definitely falls under "PHP Issues". :-D
_________________

http://home.loloyd.com/ is online if the logo graphic at left is showing.
Back to top View user's profile Send private message Visit poster's website
aprelium
-


Joined: 22 Mar 2002
Posts: 6800

PostPosted: Wed Jun 28, 2006 12:23 pm    Post subject: Reply with quote

loloyd wrote:
Hmm... the curiosity remains. I have no idea how Abyss executes a script via a pre-declared PHP interpreter, all the while passing also the required HTTP parameters and variables (to/from STDIO?).


The CGI specification is probably the best reading to understand how it works: http://hoohoo.ncsa.uiuc.edu/cgi/ .

Quote:
And I wonder why, when given only a single PHP interpreter, a 404 handler would behave differently as opposed to requesting the URI directly.

One thing for sure is that this definitely falls under "PHP Issues". :-D


Browsing /error.php and having /error.php invoked as a custom error script do not work the same way. Actually it is the "environment" which is not the same. In the second case, information about the original URI and the error is added and the call is made internally (it's an internal redirection inside the server).
_________________
Support Team
Aprelium - http://www.aprelium.com
Back to top View user's profile Send private message Send e-mail
Display posts from previous:   
Post new topic   Reply to topic    Aprelium Forum Index -> PHP 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