Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
243 views
in Technique[技术] by (71.8m points)

php - Passthru works in development server but not in apache

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

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)
Waitting for answers

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...