POV-Ray : Newsgroups : povray.unix : Need Help With Running POV-Ray Through PHP : Re: Need Help With Running POV-Ray Through PHP Server Time
4 May 2024 20:46:45 EDT (-0400)
  Re: Need Help With Running POV-Ray Through PHP  
From: Le Forgeron
Date: 10 Mar 2011 13:54:47
Message: <4d791e77@news.povray.org>
Le 10/03/2011 17:06, Jess nous fit lire :
> I'm working on a project that involves writing input from a text box to a POV
> file, running POV-Ray (version 3.6.1) through a UNIX shell via a website and
> outputting the resulting PNG file. Here is the code I have so far:

> I've tried using shell_exec(), exec(), and system() to render a test file, but
> it doesn't seem to work from the test PHP webpage I'm using. Oddly enough, it
> works when I run the PHP script through the shell.
> 
> Also, when I tried running it through system() with a return value variable, I
> got a return value of 1, which I think means there's an error.
> 
> I'm not sure if this detail is important, but in order to write to the POV file,
> I had to change the file permission code to 666. I wouldn't think the file
> permissions would be causing this problem, but maybe it actually is and I'm just
> not realizing it.
> 
> So, is there something else I should be doing to get this to work? Is it even
> possible to run POV-Ray through PHP?

Do you own the webserver ?

Does the webserver run in a chroot ?

Are you aware that php get a property "max_execution_time" which would
limit the time available...

can you provide the phpinfo() ? (or check it yourself)

For instance, with safe_mode on, only binary in safe_mode_exec_dir would
get allowed.

Is povray inside the php-path ? (or would you provide the full path
instead ? (hint: if chroot, beware to use the right value!)

Have you turn off the display of povray (trying to open a X11 display is
a bad idea when launched from script)

What about instead of dynamic rendition, have a render farm:
 * The web page create the file.pov in a directory (automatic naming).
 * a demon scan the directory and run povray for the new file (moving
the file from "./to_render" to "./in_progress".
 * when the image is finished in "./in_progress", both the pov & image
are moved to "./done"
 * the submission page returned a page with refresh and the img src=link
to "./done/" image... when ready, it appears.

You might also want some automatic clean up...


Post a reply to this message

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.