0

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
  • 2
    probably permission issues ... (its trying to write the image to a directory that the web acct does not have write access to) Commented Oct 16, 2013 at 19:08
  • I added the neccessary permissions to the folder, but it doesn't work. Commented Oct 17, 2013 at 15:50

2 Answers 2

0

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.

Sign up to request clarification or add additional context in comments.

Comments

0

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

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.