POV-Ray : Newsgroups : povray.unix : Need Help With Running POV-Ray Through PHP Server Time
4 May 2024 23:05:58 EDT (-0400)
  Need Help With Running POV-Ray Through PHP (Message 6 to 15 of 15)  
<<< Previous 5 Messages Goto Initial 10 Messages
From: Jaime Vives Piqueres
Subject: Re: Need Help With Running POV-Ray Through PHP
Date: 11 Mar 2011 05:56:10
Message: <4d79ffca$1@news.povray.org>

>
> I don't know if the web server is running on chroot, but I did find
> that the server's PHP installation has a max_execution_time of 30 and
> safe mode is off.
>
> POV-Ray isn't in the PHP path, but running it from the file path
> (/usr/bin/povray) didn't help.
>

   Did you try Jerome advice to turn off the display? ...I assumed you
were turning it off already, but now I don't see the -d switch on your
system call.

   Additionally, you can write the streams to a file to try to spot the
problem (see output options on the docs).


-- 
Jaime Vives Piqueres
		
La Persistencia de la Ignorancia
http://www.ignorancia.org


Post a reply to this message

From: Jess
Subject: Re: Need Help With Running POV-Ray Through PHP
Date: 11 Mar 2011 16:00:00
Message: <web.4d7a8cc5594502e23530d40@news.povray.org>
>    Did you try Jerome advice to turn off the display? ...I assumed you
> were turning it off already, but now I don't see the -d switch on your
> system call.
>
>    Additionally, you can write the streams to a file to try to spot the
> problem (see output options on the docs).
>
>
> --
> Jaime Vives Piqueres
>
> La Persistencia de la Ignorancia
> http://www.ignorancia.org

I didn't try turning off the display until today, but that also didn't work.


Post a reply to this message

From: Le Forgeron
Subject: Re: Need Help With Running POV-Ray Through PHP
Date: 11 Mar 2011 16:35:22
Message: <4d7a959a$1@news.povray.org>
Le 11/03/2011 21:57, Jess nous fit lire :
> I didn't try turning off the display until today, but that also didn't work.
> 
> 
How does "povray --benchmark" perform from your webserver/php ?
(and directly from command line ?)


Post a reply to this message

From: Jess
Subject: Re: Need Help With Running POV-Ray Through PHP
Date: 12 Mar 2011 02:00:05
Message: <web.4d7b196f594502e27a0819aa0@news.povray.org>
Le_Forgeron <jgr### [at] freefr> wrote:
> Le 11/03/2011 21:57, Jess nous fit lire :
> > I didn't try turning off the display until today, but that also didn't work.
> >
> >
> How does "povray --benchmark" perform from your webserver/php ?
> (and directly from command line ?)

The benchmark render took 22 minutes to complete from the command line, but
didn't work at all from PHP (running it with system still gives me a return
value of 1, which I found out is a generic error code).


Post a reply to this message

From: Le Forgeron
Subject: Re: Need Help With Running POV-Ray Through PHP
Date: 12 Mar 2011 05:06:50
Message: <4d7b45ba$1@news.povray.org>
Le 12/03/2011 07:57, Jess nous fit lire :
> Le_Forgeron <jgr### [at] freefr> wrote:
>> Le 11/03/2011 21:57, Jess nous fit lire :
>>> I didn't try turning off the display until today, but that also didn't work.
>>>
>>>
>> How does "povray --benchmark" perform from your webserver/php ?
>> (and directly from command line ?)
> 
> The benchmark render took 22 minutes to complete from the command line, but
> didn't work at all from PHP (running it with system still gives me a return
> value of 1, which I found out is a generic error code).
> 
> 

Ok, time to switch povray for a hello_world program then.
(i.e. write & compile a hello_world program, and get it called from
shell then php/webserver.
 1. Does it work the same ? (does it fail the same way ?)
 2. second level debugging: add more printf in the the hello program to
display:
 * all the arguments/parameter (including argv[0]),
 * process id ( getpid() )
 * user id (both real & effective : getuid(), geteuid() )
 * current directory ( getcwd() or get_current_dir_name() )
 * perform some i/o operation on the disk (like opendir("/tmp"), and
display all entries ? compare with actual content of /tmp)

Something like that:
-----------------------

#include <sys/types.h>
#include <dirent.h>

int main(int argc,char**argv)
{
	int ii;
	DIR* tmpdir;
	struct dirent *entry;
	printf("Hello, world\n");
	for(ii=0;ii<argc;ii++)
	{
		printf("arg %d : \"%s\"\n",ii,argv[ii]);
	}
	printf("This is pid %d\n",getpid());
	printf("Run as user %d (effective %d)\n",getuid(),geteuid());
printf("The current directory is : %s\n",get_current_dir_name());
	tmpdir=opendir("/tmp");
	printf("Opendir /tmp returned: %p\n",tmpdir);
	if (tmpdir)
	{
		do
		{
			entry = readdir(tmpdir);
			if (entry)
			{
				printf("Filename %s\n",entry->d_name);
			}
		} while (entry);
		ii=closedir(tmpdir);
		printf("Closedir returned %d\n",ii);
	}
	return 0;
}

----------------


Post a reply to this message

From: Jess
Subject: Re: Need Help With Running POV-Ray Through PHP
Date: 12 Mar 2011 14:20:00
Message: <web.4d7bc718594502e27a0819aa0@news.povray.org>
> Ok, time to switch povray for a hello_world program then.
> (i.e. write & compile a hello_world program, and get it called from
> shell then php/webserver.
>  1. Does it work the same ? (does it fail the same way ?)
>  2. second level debugging: add more printf in the the hello program to
> display:
>  * all the arguments/parameter (including argv[0]),
>  * process id ( getpid() )
>  * user id (both real & effective : getuid(), geteuid() )
>  * current directory ( getcwd() or get_current_dir_name() )
>  * perform some i/o operation on the disk (like opendir("/tmp"), and
> display all entries ? compare with actual content of /tmp)
>
> Something like that:
> -----------------------
>
> #include <sys/types.h>
> #include <dirent.h>
>
> int main(int argc,char**argv)
> {
>  int ii;
>  DIR* tmpdir;
>  struct dirent *entry;
>  printf("Hello, world\n");
>  for(ii=0;ii<argc;ii++)
>  {
>   printf("arg %d : \"%s\"\n",ii,argv[ii]);
>  }
>  printf("This is pid %d\n",getpid());
>  printf("Run as user %d (effective %d)\n",getuid(),geteuid());
> printf("The current directory is : %s\n",get_current_dir_name());
>  tmpdir=opendir("/tmp");
>  printf("Opendir /tmp returned: %p\n",tmpdir);
>  if (tmpdir)
>  {
>   do
>   {
>    entry = readdir(tmpdir);
>    if (entry)
>    {
>     printf("Filename %s\n",entry->d_name);
>    }
>   } while (entry);
>   ii=closedir(tmpdir);
>   printf("Closedir returned %d\n",ii);
>  }
>  return 0;
> }
>
> ----------------
I copied the above code into another file. Here's my output from the shell:
[jlb41@wyrd public_html]$ ./a.out
Hello, world
arg 0 : "./a.out"
This is pid 10972
Run as user 1547 (effective 1547)
The current directory is : /home/jlb41/public_html
Opendir /tmp returned: 0xb45030
Filename pulse-fIaYVQ4ftTFx
Filename pulse-ddsuEvxoRlP9
Filename .X0-lock
Filename orbit-gdm
Filename .ICE-unix
Filename .X11-unix
Filename 4d24887f11a5c
Filename lost+found
Filename orbit-acrum
Filename virtual-acrum.0BJ3Jx
Filename .esd-501
Filename ..
Filename pulse-OmdOnASl52ii
Filename .
Filename .htaccess
Filename pear
Filename virtual-acrum.ZeaNM4
Closedir returned 0

And the output from PHP:
Hello, world
arg 0 : "./a.out"
This is pid 10971
Run as user 48 (effective 48)
The current directory is : /home/jlb41/public_html
Opendir /tmp returned: 0x1601030
Filename pulse-fIaYVQ4ftTFx
Filename pulse-ddsuEvxoRlP9
Filename .X0-lock
Filename orbit-gdm
Filename .ICE-unix
Filename .X11-unix
Filename 4d24887f11a5c
Filename lost+found
Filename orbit-acrum
Filename virtual-acrum.0BJ3Jx
Filename .esd-501
Filename ..
Filename pulse-OmdOnASl52ii
Filename .
Filename .htaccess
Filename pear
Filename virtual-acrum.ZeaNM4
Closedir returned 0

When I run the code from both the shell and PHP, the /tmp value changes and the
pid increments. Is that supposed to happen?

I forgot to mention too that I can run shell commands like ls and dir from PHP.
Just not POV-Ray. I think it might have to do with some sort of permission
denial by PHP that I'm not knowing about.


Post a reply to this message

From: Le Forgeron
Subject: Re: Need Help With Running POV-Ray Through PHP
Date: 12 Mar 2011 14:56:40
Message: <4d7bcff8$1@news.povray.org>
Le 12/03/2011 20:18, Jess nous fit lire :

> This is pid 10972
> Run as user 1547 (effective 1547)
> The current directory is : /home/jlb41/public_html

> And the output from PHP:
> Hello, world
> arg 0 : "./a.out"
> This is pid 10971
> Run as user 48 (effective 48)
> The current directory is : /home/jlb41/public_html

> When I run the code from both the shell and PHP, the /tmp value changes and the
> pid increments. Is that supposed to happen?
> 

Yes, it's a memory pointer... only Null would have been an issue.

> I forgot to mention too that I can run shell commands like ls and dir from PHP.
> Just not POV-Ray. I think it might have to do with some sort of permission
> denial by PHP that I'm not knowing about.

Time to check the rights of user 48, including its groups. (and the
compatibility with the installation of povray)
Can you "su - to_the_name_of_user_48" ?
(have a look/grep in /etc/passwd for 48)

And sanity check first: can 48 write in the current directory ?
Can php/web create a file ?
    system("date >new_test_file")


Post a reply to this message

From: Jess
Subject: Re: Need Help With Running POV-Ray Through PHP
Date: 13 Mar 2011 03:00:00
Message: <web.4d7c6aca594502e27a0819aa0@news.povray.org>
> Time to check the rights of user 48, including its groups. (and the
> compatibility with the installation of povray)
> Can you "su - to_the_name_of_user_48" ?
> (have a look/grep in /etc/passwd for 48)

Here's the output when I grep-ed for 48. User 48 appears to be in Apache.

[jlb41@wyrd ~]$ grep 48 /etc/passwd
apache:x:48:48:Apache:/usr/local/apache2:/bin/bash
smolt:x:493:488:Smolt:/usr/share/smolt:/sbin/nologin
torrent:x:492:487:BitTorrent Seed/Tracker:/var/lib/bittorrent:/sbin/nologin
pulse:x:491:486:PulseAudio System Daemon:/var/run/pulse:/sbin/nologin
clamupdate:x:490:482:Clamav database update user:/var/lib/clamav:/sbin/nologin
clamilt:x:489:481:Clamav Milter User:/var/run/clamav-milter:/sbin/nologin
gam7:x:1486:1486:Gabriel Manzano:/home/gam7:/bin/bash
math470:x:1607:1607:Math 480 senior seminar:/home/math470:/bin/bash
webeffect:x:2148:2148::/home/webeffect:/bin/bash
skb1:x:1648:1648:Sharon Kay Beck:/home/skb1:/bin/bash

> And sanity check first: can 48 write in the current directory ?
> Can php/web create a file ?
>     system("date >new_test_file")

PHP couldn't create the date file, so I guess that means User 48/PHP doesn't
have permission to create files.


Post a reply to this message

From: Le Forgeron
Subject: Re: Need Help With Running POV-Ray Through PHP
Date: 13 Mar 2011 04:33:46
Message: <4d7c816a$1@news.povray.org>
Le 13/03/2011 07:57, Jess nous fit lire :
> 
>> Time to check the rights of user 48, including its groups. (and the
>> compatibility with the installation of povray)
>> Can you "su - to_the_name_of_user_48" ?
>> (have a look/grep in /etc/passwd for 48)
> 
> Here's the output when I grep-ed for 48. User 48 appears to be in Apache.
> 
> [jlb41@wyrd ~]$ grep 48 /etc/passwd
> apache:x:48:48:Apache:/usr/local/apache2:/bin/bash

>> And sanity check first: can 48 write in the current directory ?
>> Can php/web create a file ?
>>     system("date >new_test_file")
> 
> PHP couldn't create the date file, so I guess that means User 48/PHP doesn't
> have permission to create files.

It's a matter of rights. I guess that jlb41 & apache are not in the same
primary group either, so the directory /home/jlb41/public_html would
need to be writable by other (and that might become a security/deface
issue; you might want to play in a deeper sub-directory in production).

First take note of the rights from "ls -ld /home/jlb41/public_html"
then try "chmod 777 /home/jlb41/public_html"
and try again php for system("date >new_test_file")

If it works, then try povray.


Post a reply to this message

From: Jess
Subject: Re: Need Help With Running POV-Ray Through PHP
Date: 13 Mar 2011 14:00:01
Message: <web.4d7d052c594502e27a0819aa0@news.povray.org>
> It's a matter of rights. I guess that jlb41 & apache are not in the same
> primary group either, so the directory /home/jlb41/public_html would
> need to be writable by other (and that might become a security/deface
> issue; you might want to play in a deeper sub-directory in production).
>
> First take note of the rights from "ls -ld /home/jlb41/public_html"
> then try "chmod 777 /home/jlb41/public_html"
> and try again php for system("date >new_test_file")

Here's what I got back from "chmod 777 /home/jlb41/public_html":

drwxr-xr-x. 11 jlb41 jlb41 4096 Mar 12 14:05 /home/jlb41/public_html

system("date >new_test_file") works through PHP now.

> If it works, then try povray.

I changed the file permissions for object.png to 666 and it works now! Thank you
so much for your help. I really appreciate it!


Post a reply to this message

<<< Previous 5 Messages Goto Initial 10 Messages

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