Jump to content

Daemon to run php


Marcodisco

Recommended Posts

Hi,

 

I am using a slightly modded version of tftp-hpa (tftp-hpa-execute) that allows a program to be run when a tftp request is received.

 

For testing, I have writtem a small php program that just takes a parameter and adds the text of the parameter to a log file.

 

conout.php sometext

 

If I run:

#./conout.php testing

or

/etc/conout.php testing

 

from the prompt, the text "testing" is added to my log file as exepected.

 

When I plumb the same program into the mechanism provided by tftp-hpa-execute, nothing gets added to the text file when a tftp download is requested.

 

I have used STRACE to check what is happenning. Some of the output is below:

 

[pid  7024] open("/etc/localtime", O_RDONLY) = -1 ENOENT (No such file or directory)

[pid  7024] open("/etc/localtime", O_RDONLY) = -1 ENOENT (No such file or directory)

[pid  7024] open("/etc/localtime", O_RDONLY) = -1 ENOENT (No such file or directory)

[pid  7024] sendto(3, "<30>Feb  4 09:22:08 in.tftpd[702"..., 91, MSG_NOSIGNAL, NULL, 0) = 91

[pid  7024] execve("/etc/conout.php", ["/etc/conout.php", "test22.txt"], [/* 22 vars */]) = -1 ENOENT (No such file or directory)

[pid  7024] open("/etc/localtime", O_RDONLY) = -1 ENOENT (No such file or directory)

[pid  7024] open("/etc/localtime", O_RDONLY) = -1 ENOENT (No such file or directory)

[pid  7024] open("/etc/localtime", O_RDONLY) = -1 ENOENT (No such file or directory)

 

The execve line shows a return of -1, (No such file or directory).

 

Can anyone suggest why this is the case, when the file /etc/conout.php does exist.

 

I had thought it might be a permissions issue, the tftp daemon runs as user Nobody, but then I would expect a different error in strace.

 

Thanks,

Mark

Link to comment
https://forums.phpfreaks.com/topic/190968-daemon-to-run-php/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.