0

I wrote a Python script which writes its output into a txt file. Then I included that file in my html/php website. - works good so far. Only remaining problem: I can't execute the .py file automatically while opening the site. I know that this isn't the best solution <?PHP exec("python3 Auswertung.py"); ?> doesn't seem to work

4
  • Did you try shell_exec? Commented Apr 28, 2022 at 15:49
  • 1
    Any reason not to write the script in PHP instead? Commented Apr 28, 2022 at 15:52
  • 1
    What happens when executing exec("python3 Auswertung.py")? Likely web user doesn't have permissions to create the file, or execute the python Commented Apr 28, 2022 at 15:58
  • I tried shell_exec with the same result. I could‘ve written it in php but I was too lazy actually. Yes, I think the permissions were the problem. Commented Apr 30, 2022 at 12:09

1 Answer 1

1

I used the commands chown -R www-data:www-data <directory> and chmod -R 755 <directory>. I'm not sure which command solved my problem, but at least its working.

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

Comments

Your Answer

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