简体   繁体   中英

Can't open gnome-terminal with php

I actually try to laucnh a gnome-term with a php script, seems i have some problems with the users www-data;

my script make only a ls -l command in a directory (is just for a test) and i run it with a php page in my local-web site.

here the gnome-terminal command in my bash script (he run perfectly when i double-click on him) :

gnome-terminal --working-directory=/opt/cuckoo -x bash -c "ls -l"

and here is the call on the php-page :

system("/my/path/to/the/script/script.sh");

i have some echo in my script and i see them in the php page after i try to run the script with the php.page.

i think www-data don't have the right to do so i give the ownership of the script with the chown command, and at last a try the sudo visudo command and make the script execute like the user www-data is root (with NO PASSWD arg)

But i can't open the terminal and make a ls at last, i try with exec too, and show the result with $ouput butthe result is the same as well.

At last my question is : Php can really run a terminal or maybe a fool myself^^? Thanks for taking time to rescure me ;)

PHP can run everything, but depends who spawns it. Forget just running X apps from a web server - you'll need more than just executing them (permissions, DISPLAY and Xauth settings). Read more about the X clients and architecture.

Probably the right place to ask this is at SuperUser , since the problem is not in the coding itself.

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