I've got a python/R script, that utilizes both Python and R to compute a figure. The particular figure is produced by R also it can be saved like a PNG image. This works fine when examined around the machine, inside a folder with correct permissions, but I must get it done online now. I've an Apache/PHP interface that transmits the consumer data towards the Python script, and also the Python script works together with R to compute the figure.

Now the image can't be saved on Apache by R. What's the easiest method to enable this temporary file creation by exterior programs like R and Python? Further on, I want the image to become displayed, then erased in the finish from the PHP session.

While certainly helpful, any techniques that only allow access for Python, or R are not adequate enough. My question is just one of client-server 'modus operandi' in Apache: suppose program X is known as by PHP. How do you need to allow program X to keep and send pictures/text/whatever to PHP and just how to implement that?

Developing a server-accessible folder with full permissions appears just like a security black hole.

With R, you are able to tempfile creates filenames for temp files. You might use file.remove to remove the file later, however it seems like this is done most from PHP code (if so that it is removed once the PHP session finishes).

plot_file <- paste(tempfile(tmpdir = "some_dir_with_write_permission"), "png", sep = ".")


#later on ...