I have apache server installed on redhat linux. I have a PHP script that needs to call a python wrapper script that calls another python script which has a function to execute some database queries. So, my php script is in location /var/www/html: If I execute the python script from this location command line the script works fine. However, If I run the exact same command through exec inside PHP, I get "permission denied". The whoami at /var/www/html gives my linux user id. Inside php script exec("whoami") returns apache. and echo get_current_user(); returns my linux user id. Which is understandable since get_current_user returns the owner of the php script. How should I fix this problem? Is the problem because user "apache" does not have access to the script? User "smeeta" does have access to execute the script.
Any guidance here is highly appreciated.