POV-Ray : Newsgroups : povray.unix : Need Help With Running POV-Ray Through PHP : Need Help With Running POV-Ray Through PHP Server Time
5 May 2024 00:00:32 EDT (-0400)
  Need Help With Running POV-Ray Through PHP  
From: Jess
Date: 10 Mar 2011 11:10:00
Message: <web.4d78f406f7eba3343530d40@news.povray.org>
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:

<?php
//Code for writing to a file
$input = $_POST['input'];
$file = "object.pov";
$save = fopen($file, 'w');
fwrite($save, $input);
fclose($save);

//Code for executing a shell command
system("povray object.pov");
?>
<form method="post" action="write_test.php">
<textarea name="input" rows="10" cols="61">
</textarea>
<input type="submit" name="button" value="Write" />
</form>
<img src="object.png"/>

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?


Post a reply to this message

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