CGI Error with Relationship Graphs

Get help from other users here.

Moderators: Developer, Contributor

Post Reply
rmc
Posts: 8
Joined: 23 Mar 2012, 11:47

CGI Error with Relationship Graphs

Post by rmc »

My System is configured as below:

Windows Server 2003
IIS 6.0
PHP 5.3.10 (FastCGI for IIS)
MantisBT 1.2.9
WinGraphviz 1.02.24
MySQL 5.5.21

With an earlier test on this system with PHP 5.2.17 (ISAPI) the graphs were displayed correctly until this morning when I started getting a PHP access violation (probably because I was running with the thread-safe version of PHP - not recommended for IIS apparently). However, having upgraded to 5.3.10 non-thread-safe and using FastCGI instead of ISAPI, I now get:

"CGI Error - The specified CGI application misbehaved by not returning a complete set of HTTP headers."

Has anyone experienced this or can you suggest where I might start looking for the solution?
rmc
Posts: 8
Joined: 23 Mar 2012, 11:47

Re: CGI Error with Relationship Graphs

Post by rmc »

OK, I've got a bit further tracing where the problem is. It appears to be failing on the first call to a WinGraphviz method:

$t_dot_output = $t_graphviz->ToTextGraph( $t_dot_source, $t_type );

i.e. when the relationship graph map is being output. Having gradually worked through the code in graphviz_api.php, putting debug statements in as I went, I know that the $graphviz COM object is being instantiated OK, it's just that the method ToTextGraph won't execute.

I've tried putting in a try{} ... catch() {} block around the call but it still fails and gives me the CGI Error message.

This smells very much like a permissions problem where the web user is being denied access to execute the COM method.

Everything runs OK from the command line so WinGraphviz is installed OK.

Any thoughts?
rmc
Posts: 8
Joined: 23 Mar 2012, 11:47

Re: CGI Error with Relationship Graphs

Post by rmc »

It's Monday morning and I've made some progress ... it's definitely a permissions problem.

I monitored what was happening on the server using ProcMon, part of the SysInternals suite, and found that I was getting an Access Denied error when php-cgi.exe was trying to open a file for Write access on D:\ (random filename so I'm assuming it's a temporary file used by WinGraphviz). Granting Modify access to D:\ for for the Internet Anonymous User, IUSR_<server_name> with 'icacls d:\ /grant IUSR:(OI)(CI)(M)' stops the CGI Error and displays the relationship graph page although the graph still isn't visible - this may well be due to my having sprayed the code with 'echo' statements and commented out bits to try and isolate the problem. Once I've restored the files with clean copies from the MantisBT Zip file the result may be different.

I guess the question is now, "why does WinGraphviz apparently try to cache a file on the root of my Data drive (my MantisBT website is installed in a subdirectory of D:\) and can it or php-cgi.exe be made to use another more sensible location for its cache?".

On a slightly different tack, why is such an old, apparently unmaintained version of Graphviz being used for Windows installations of MantisBT when the mainstream development (and in its wake most Linux installations) has moved on significantly? WinGraphviz is static at version 1.02.24 for the MSI file and 1.02.25s for the CAB file whilst the Linux RPM's (at least the one installed from the CentOS 6 repositories) are at version 2.28. I note that there is a PHP extension module distributed as part of the current version of Graphviz - could this not be used to give Mantis access to the required resources on Windows if the current version is installed rather than WinGraphviz?

Update: Removing all my debug 'echo' statements, commented lines and extra 'return' with the permissions set as above allows the relationship graph to display correctly.
Post Reply