I am using php script on my apache / ubuntu server to call a bash script that launches an application that takes a python script as an argument (IDAPro).
PHP code
chdir('/var/www/dashboard/team/static/sql'); $output = exec('sudo -u rohan ./start.sh');
Now the above code works fine if I run the PHP file from the terminal, but only if I run it as the root user. Needless to say, if I run the bash file directly, it starts too.
But when I run the PHP file in the browser, it does not work, and I get the following error in the apache error log:
QXcbConnection: Could not connect to display Aborted
I understand that Apache / php works as the user of "www-data" (used by "whoami" for verification), and that is why I have sudo in my exec. I changed and remade permissions for both users to no avail. When I run the php file from the terminal as the user "www-data", it does not throw an error, but does nothing but display random echo tags at the beginning and end of the script to debug it.
I am a beginner novice, so any help is appreciated.
source share