By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
438,278 Members | 1,329 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 438,278 IT Pros & Developers. It's quick & easy.

POVRay through PHP

P: n/a
Hello all

I have trouble in calling POVRay through PHP.

This is what I tried:

- create a PHP file (say call.php) with the content
<?php
header("Content-Type: image/png");
passthru("./xxx.cgi");
?>

- have the following in xxx.cgi
#!/bin/bash
/usr/local/bin/povray +O- myfirst.pov 2> /tmp/errors.txt

which supposedly send the picture to stdin in PNG format.

Result:
The browser displays "The image http://.../call.php cannot be
displayed, because it contains errors."

The access_log records a status 200 line, error_log contains
"./xxx.cgi: line 2: 27809 segmentaion fault /usr/local/bin/povray \
+O- myfirst.pov 2> /tmp/errors.txt"

and /tmp/errors.txt is empty.
Executing ./xxx.cgi on the command line, works as expected:
a binary is sent to the screen, /tmp/errors.txt contains the
usual POVRay log.
The obvious mistake of not having privileges is IMHO solved.

a) I can do "su - nobody" (Apache runs as nobody:nogroup) and
execute xxx.cgi, it works.

b) I've changed the user:group of Apache process to be myself
(normaluser:users). It didn't help.
Why POVRay behaves differently if called from PHP is a puzzle.
Just as a control experiment I tried this:
change call.php to
<?php
header("Content-Type: text/html");
passthru("./xxx.cgi");
?>

and have a xxx.cgi like
#!/bin/bash
/usr/bin/pod2html /usr/doc/openssl-0.9.6d/doc/crypto/rc4.pod

It works properly, i.e. I get the formatted HTML version of rc4.pod.
Can somebody explanation this?

Arun

Jul 16 '05 #1
Share this question for a faster answer!
Share on Google+

This discussion thread is closed

Replies have been disabled for this discussion.