cucuru Posted January 14, 2010 Share Posted January 14, 2010 hello. I'm trying to execute a linux console with PHP, I tried exec, shell_exec, passthru... but it seems that they can't. I looked the security and this is my answer: -rwxr-xr-x 1 root root 301272 2009-10-20 07:35 "gnome-terminal" so, everybody can execute the console. Maybe the problem is the path: $output = exec('/bin/usr/gnome-terminal'); Or maybe it is another problem. Could you help me? Thanks. Regards Link to comment https://forums.phpfreaks.com/topic/188435-execute-linux-program/ Share on other sites More sharing options...
trq Posted January 14, 2010 Share Posted January 14, 2010 /bin/usr doesn't exist on any Linux Ive worked with. Try... $output = exec('/usr/bin/gnome-terminal'); I'm not sure what your expecting to do with a term program however. Link to comment https://forums.phpfreaks.com/topic/188435-execute-linux-program/#findComment-994761 Share on other sites More sharing options...
cucuru Posted January 14, 2010 Author Share Posted January 14, 2010 I'm sorry... but I don't see the different between your PHP code and mine... I just want open a console. I found this in error.log in apache2: GConf Error: Failed to contact configuration server; some possible causes are that you need to enable TCP/IP networking for ORBit, or you have stale NFS locks due to a system crash. See http://projects.gnome.org/gconf/ for information. (Details - 1: Not running within active session) Configuration server??? I want open it in client side... Thank you Link to comment https://forums.phpfreaks.com/topic/188435-execute-linux-program/#findComment-994767 Share on other sites More sharing options...
dgoosens Posted January 14, 2010 Share Posted January 14, 2010 PHP runs server side... This means it has no ways of communicating directly with the client's machine... What you're trying to achieve is not possible with PHP. Link to comment https://forums.phpfreaks.com/topic/188435-execute-linux-program/#findComment-994768 Share on other sites More sharing options...
cucuru Posted January 14, 2010 Author Share Posted January 14, 2010 it isn't possible? do you know how can I do it? ActiveX is just for windows, isn't it? Thank you. Regards Link to comment https://forums.phpfreaks.com/topic/188435-execute-linux-program/#findComment-994770 Share on other sites More sharing options...
trq Posted January 14, 2010 Share Posted January 14, 2010 Firstly, to clear a point, I was using the path /usr/bin not /bin/usr, but anyway.... You cannot possibly open a console client side via php. PHP executes on the server, not the client. Link to comment https://forums.phpfreaks.com/topic/188435-execute-linux-program/#findComment-994771 Share on other sites More sharing options...
dgoosens Posted January 14, 2010 Share Posted January 14, 2010 it isn't possible? do you know how can I do it? ActiveX is just for windows, isn't it? Thank you. Regards even if it were possible, why would a Windows user want to open a console ? I mean, Linux users most of the time know what a console is... but I am pretty sure that a webpage that would open a Windows console would freak most of the users out !! what are you trying to get done exactly ? try to explain that clearly and we might come up with a solution... Link to comment https://forums.phpfreaks.com/topic/188435-execute-linux-program/#findComment-994775 Share on other sites More sharing options...
cucuru Posted January 14, 2010 Author Share Posted January 14, 2010 Ok, I'll try explain better. I want opening a console in a Linux client and the server is also a Linux machine. the console exist in the client, I want executing it, the console existing in the client machine. I said the ActiveX because I saw some examples in the web, but I think it's impossible to me use them. Thanks for your time. Regards Link to comment https://forums.phpfreaks.com/topic/188435-execute-linux-program/#findComment-994777 Share on other sites More sharing options...
dgoosens Posted January 14, 2010 Share Posted January 14, 2010 Ok, I'll try explain better. I want opening a console in a Linux client and the server is also a Linux machine. the console exist in the client, I want executing it, the console existing in the client machine. I said the ActiveX because I saw some examples in the web, but I think it's impossible to me use them. Thanks for your time. Regards but why would you want to launch the console on the client's machine ? What is supposed to happen next ? Link to comment https://forums.phpfreaks.com/topic/188435-execute-linux-program/#findComment-994783 Share on other sites More sharing options...
oni-kun Posted January 14, 2010 Share Posted January 14, 2010 Ok, I'll try explain better. I want opening a console in a Linux client and the server is also a Linux machine. the console exist in the client, I want executing it, the console existing in the client machine. I said the ActiveX because I saw some examples in the web, but I think it's impossible to me use them. Thanks for your time. Regards Yes, It may be possible to run the terminal but what are you attempting to do with it? If you're wanting to run commands such as 'ls /usr/bin' then you need not a terminal, or are you trying to make a direct 'link' to feed it commands? Link to comment https://forums.phpfreaks.com/topic/188435-execute-linux-program/#findComment-994786 Share on other sites More sharing options...
cucuru Posted January 14, 2010 Author Share Posted January 14, 2010 I just need open it. The rest of things are latter... You said it is possible, could you say me how, please? I'm trying it for 2 days! Thanks. Regards Link to comment https://forums.phpfreaks.com/topic/188435-execute-linux-program/#findComment-994788 Share on other sites More sharing options...
dgoosens Posted January 14, 2010 Share Posted January 14, 2010 I just need open it. The rest of things are latter... well, it does matter though... how do you expect to communicate with it ? Link to comment https://forums.phpfreaks.com/topic/188435-execute-linux-program/#findComment-994790 Share on other sites More sharing options...
oni-kun Posted January 14, 2010 Share Posted January 14, 2010 I just need open it. The rest of things are latter... You said it is possible, could you say me how, please? I'm trying it for 2 days! Thanks. Regards What do you mean? You cannot use PHP to maintain an active server session with a terminal, all you can do is feed commands to it. There is a thing called SSH that can do this for you, provided you understand in the first place this can't be handled via PHP itself. Link to comment https://forums.phpfreaks.com/topic/188435-execute-linux-program/#findComment-994791 Share on other sites More sharing options...
cucuru Posted January 14, 2010 Author Share Posted January 14, 2010 ok, I'm sorry, I had to explain it before... I want open a SSH conection with ssh2 extension of php, and after it open the terminal (with the conection created), I know I can simulate a terminal with ssh2 extension, but I can't do it, my boss forgive it to me. Thank you for your time. regards Link to comment https://forums.phpfreaks.com/topic/188435-execute-linux-program/#findComment-994793 Share on other sites More sharing options...
oni-kun Posted January 14, 2010 Share Posted January 14, 2010 ok, I'm sorry, I had to explain it before... I want open a SSH conection with ssh2 extension of php, and after it open the terminal (with the conection created), I know I can simulate a terminal with ssh2 extension, but I can't do it, my boss forgive it to me. Thank you for your time. regards It's still hard to know what you're wanting to achieve without an example of what you're trying to do with the shell open, but I'm sure you can find your answers. Here's an example use of the SSH2 PHP lib: http://kevin.vanzonneveld.net/techblog/article/make_ssh_connections_with_php/ Link to comment https://forums.phpfreaks.com/topic/188435-execute-linux-program/#findComment-994797 Share on other sites More sharing options...
cucuru Posted January 14, 2010 Author Share Posted January 14, 2010 The ssh connection works. Now, I want open a console with this connection, so I don't have to write: ssh -p xxxx yy.yy.yy.yy and the password, it is done by php. So, I open the console and use it as usual, I just have a lot of connections (ssh and http) and I need to put it together in a web site, because the user don't know the password, and havn't the certificate. Regards Link to comment https://forums.phpfreaks.com/topic/188435-execute-linux-program/#findComment-994800 Share on other sites More sharing options...
trq Posted January 14, 2010 Share Posted January 14, 2010 I'll say it again. You cannot open a terminal or any other application on a client using php. End of story. Link to comment https://forums.phpfreaks.com/topic/188435-execute-linux-program/#findComment-994801 Share on other sites More sharing options...
oni-kun Posted January 14, 2010 Share Posted January 14, 2010 I'll say it again. You cannot open a terminal or any other application on a client using php. End of story. Why are you taking his wording so literal? Link to comment https://forums.phpfreaks.com/topic/188435-execute-linux-program/#findComment-994803 Share on other sites More sharing options...
cucuru Posted January 14, 2010 Author Share Posted January 14, 2010 I'll say it again. You cannot open a terminal or any other application on a client using php. End of story. I'll never understand why are people so unpleasant, if you don't want help me, don't do it, don't open this post, but forums are for helping people... so... I know it is not possible do it with php, I asked before if you know how, javascript maybe? Thank you everybody, including thorpe Link to comment https://forums.phpfreaks.com/topic/188435-execute-linux-program/#findComment-994811 Share on other sites More sharing options...
trq Posted January 14, 2010 Share Posted January 14, 2010 I'll say it again. You cannot open a terminal or any other application on a client using php. End of story. I'll never understand why are people so unpleasant, if you don't want help me, don't do it, don't open this post, but forums are for helping people... so... I know it is not possible do it with php, I asked before if you know how, javascript maybe? Thank you everybody, including thorpe I'm not sure what is so unkind about the facts. You asked your question in a php forum and got the appropriate answer as far as I'm concerned. To get further help, you still need to explain why you think you need a terminal, you might not need it at all. Link to comment https://forums.phpfreaks.com/topic/188435-execute-linux-program/#findComment-994830 Share on other sites More sharing options...
cucuru Posted January 14, 2010 Author Share Posted January 14, 2010 I'll say it again. You cannot open a terminal or any other application on a client using php. End of story. I'll never understand why are people so unpleasant, if you don't want help me, don't do it, don't open this post, but forums are for helping people... so... I know it is not possible do it with php, I asked before if you know how, javascript maybe? Thank you everybody, including thorpe I'm not sure what is so unkind about the facts. You asked your question in a php forum and got the appropriate answer as far as I'm concerned. To get further help, you still need to explain why you think you need a terminal, you might not need it at all. I'm going to explain you what is so unkind, I'm just answering the questions you did to me, I also asked what can I do if php is not an option... so: I'll say it again. You cannot open a terminal or any other application on a client using php. End of story. Is very unkind. Link to comment https://forums.phpfreaks.com/topic/188435-execute-linux-program/#findComment-994840 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.