简体   繁体   中英

Rights on linux apache to make php run a python script

So, there has been a lot of question to this topic and I read a lot in the last few days.

Running the php script that executes the python script from command line is fine - all works (whoami customername). Running php script in browser does not work (whoami www-data). No matter who owns both scripts, no matter what php I use to run the script (exec, system ...), php.ini checked, nothing disabled that would interfere. If I move the php script to the very root, it seems willing to exec the python script, but fails to find SSH folder that I need to do things with python script.

I gather the problem is rights. I can run the python script from command line. I can run the php script from command line. Both do the stuff it should (SSH to git server and do some things)

Its a customer server so I am limited to the things I am able to do. Would be nice to have a button in browser to make thing happen instead of sending customer to command line.

Before I finally giving up, anyone ever had the same scenario and has found a solution?

I think you want to run shell command using php. Try this might be this helping you http://php.net/manual/en/function.shell-exec.php

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM