I'm trying to execute a Python script from a Laravel project in Ubuntu 20.04 using this code:
passthru('/usr/bin/python3 /var/www/birra/public/setauto.py DB_D1 false');
$output = ob_get_clean();
This works perfectly in Laravel Development Server but for some reason it won't work in Apache. I found this SO post where someone suggested it could be a permission problem so I granted all just to check, and made www-data owner.
-rwxrwxrwx 1 www-data aid-pc 925 Jan 22 13:51 setauto.py
I also copied the cli php.ini to apache's php.ini. Restarted apache and tried config:clear
. None of these worked. Any idea of why is this happening and how could I solve it?
This shows no error, just passes as if everything went right but the script is clearly not executed since it should have affected some variables that remain the same. It also returns output=""
As suggested in the comments, I tried enabling CGI in Apache for python scripts, but it still behaves the same way.
question from:
https://stackoverflow.com/questions/65846480/passthru-works-in-development-server-but-not-in-apache 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…