0
votes

I want to run Python script from PHP. The script's syntax is good, when I run it from command line it generates an image file next to it. When I run the PHP file (contains Python exec) from command line it generates an image file. It's good. The problem is: when I use browser and run PHP it isn't generate any image file. I use Xubuntu OS.

2
probably permission issues ... (its trying to write the image to a directory that the web acct does not have write access to) - Joran Beasley
I added the neccessary permissions to the folder, but it doesn't work. - Panthesilea

2 Answers

0
votes

Does the script that you are trying to run requires sudo privileges? If so, you will need to add the user "www-data" or web user with the command (full path) to the sudoers file (Ubuntu /etc/sudoers or execute visudo command).

More info here https://help.ubuntu.com/community/Sudoers

Another thing to look at is at memory_limit in your php.ini directive. You might be using all memory allowed to use.

0
votes

The problem was the matplotlib backend setting. I changed to 'Agg' and the plot function worked fine.