Error Pages with FastCGI

General discussion on Zend Server for IBM System i
Post Reply
dan8246
Posts: 40
Joined: Fri Jan 23, 2015 5:53 pm

Error Pages with FastCGI

Post by dan8246 » Wed Nov 04, 2015 10:20 pm

I'm trying to setup some error pages for 404's, 500, etc. I'm running into difficulty though and I think it has to do with the fact my server is using fastCGI.

At first I attempted to manually add the configuration lines to my httpd.conf file with:

Code: Select all

ErrorDocument 404 /errormsg/404.php
ErrorDocument 500 /errormsg/50x_error.html
ErrorDocument 502 /errormsg/50x_error.html
ErrorDocument 503 /errormsg/50x_error.html
ErrorDocument 504 /errormsg/50x_error.html
I made sure the FileInfo override was enabled as well, but no luck. I kept getting a white screen with "No input file specified." in the top left.
I then attempted to remove my changes and use the GUI of IBM Web Administration for I with no luck. It just added the same configuration lines with the same results.
I then attempted to add the lines in in a .htaccess and while I get the same behavior, I do not get an "Internal Server Error" either.

I was curious and removed the FastCGI configuration lines and sure enough I was redirected to the appropriate page, but the PHP wasn't being rendered (as expected).

Code: Select all

AddType application/x-httpd-php .php
AddHandler fastcgi-script .php
I'm not sure if I have to edit my fastcgi script/configuration in order to do this, or if there is some setting or step I'm missing. Can anyone lend some insight?

scottgcampbell
Posts: 187
Joined: Wed Apr 22, 2009 2:29 pm
Location: Edmonton, AB, Canada

Re: Error Pages with FastCGI

Post by scottgcampbell » Thu Nov 05, 2015 3:01 pm

I have a 404 working in a virtual host, is that what you tried or do you have it at the top level?
What version of ZendServer do you have?

Code: Select all

<VirtualHost *:92>
	ServerAdmin service@yyy.ca
	DocumentRoot /www/ZendSvr/htdocs/ecomm
	ServerName www.yyy.ca
	ErrorDocument 404 /404.php
....
</VirtualHost>

dan8246
Posts: 40
Joined: Fri Jan 23, 2015 5:53 pm

Re: Error Pages with FastCGI

Post by dan8246 » Thu Nov 05, 2015 3:06 pm

I've tried it at the server level, vhost level and htaccess level. I get the same results for each.

PHP 5.6.5
ZS 8.0.2
V7R2

scottgcampbell
Posts: 187
Joined: Wed Apr 22, 2009 2:29 pm
Location: Edmonton, AB, Canada

Re: Error Pages with FastCGI

Post by scottgcampbell » Thu Nov 05, 2015 3:27 pm

I just added it at the server level and it works for me there too.

Code: Select all

Listen *:89
DocumentRoot /www/zendsvr/htdocs
ErrorDocument 404 /ecomm/404.php
Does the file exist in your <document root>/errormsg/ and do the permissions match (file and folder) to scripts that do work?

Scott

dan8246
Posts: 40
Joined: Fri Jan 23, 2015 5:53 pm

Re: Error Pages with FastCGI

Post by dan8246 » Thu Nov 05, 2015 4:22 pm

Permissions are the same for QTMHHTTP as any other folder/file. I am able to visit the error pages directly via the browser perfectly fine as well.
Is there another user which should have access?

In addition, it works if I use mod re-write rules to detect if the page exists (using -f and -d) and if not redirect to my 404 page.
But this won't work for anything other than 404 errors.

Are you using fastCGI as well?

scottgcampbell
Posts: 187
Joined: Wed Apr 22, 2009 2:29 pm
Location: Edmonton, AB, Canada

Re: Error Pages with FastCGI

Post by scottgcampbell » Thu Nov 05, 2015 8:46 pm

Yes, same as yours (almost)

Code: Select all

# zend fastcgi
AddType application/x-httpd-php .php .inc
AddHandler fastcgi-script .php .inc
Very strange that it wouldn't work for you. Could be one of the other directives in there, but I have no idea what :)

dan8246
Posts: 40
Joined: Fri Jan 23, 2015 5:53 pm

Re: Error Pages with FastCGI

Post by dan8246 » Fri Nov 06, 2015 2:36 pm

Okay, thank you. I'll try stripping out portions of my config file to see if anything is causing it.

dan8246
Posts: 40
Joined: Fri Jan 23, 2015 5:53 pm

Re: Error Pages with FastCGI

Post by dan8246 » Mon Nov 09, 2015 5:39 pm

I literally stripped down my httpd.conf file to 20-30 lines with just the bare essentials. No luck.
I'm going to open a PMR with IBM since FastCGI and Apache are maintained by them.

Scott, mind if I ask what version of Zend Server you are running? I'm just trying to figure out what is different.
I know with 7.2 Zend switched over to Apache 2.4, so if you have an earlier version that could account for the difference in behavior. Just some additional information for the PMR.

scottgcampbell
Posts: 187
Joined: Wed Apr 22, 2009 2:29 pm
Location: Edmonton, AB, Canada

Re: Error Pages with FastCGI

Post by scottgcampbell » Mon Nov 09, 2015 5:47 pm

No problem:

V7R1
Apache: Apache/2.2.11 (i5)
Zend: 2.5.0
PHP: 5.5.26
Zend Server Version: 8.5.1 Build: 100844

If you post your complete config I can compare to see if there are differences and test to see if I can break mine :)

Scott

dan8246
Posts: 40
Joined: Fri Jan 23, 2015 5:53 pm

Re: Error Pages with FastCGI

Post by dan8246 » Mon Nov 09, 2015 8:50 pm

Sure, it's always fun breaking things. I'll just PM you the info.

Post Reply