PDA

View Full Version : dedicated server remote control


Xen
04-10-2006, 04:10 PM
Hi @ll

Following Problem:

I want to have a php-script that executes an funktion with correspondent parameters on a dedicated server.

html-page is on webserver A, php-code ist on webserver B at the same time in B is also a dedicated gameserver. I wan the php-code to execute the functoin to start/stop an egaming server on B.

tried till now:
exec(), pasthru(), ssh2_exec(), system(), ssh2_connect, ssh2_exec(), shell_exec()

result:
error 127

edited the variable in php.ini: save_mode_exec_dir
and let her show to the directory where the funktion to execute ist
->problem not solved

with the idea to change the necessity of access need
i tried with a script (not-php) where the funktion with the parameters is,
and the php-code only has to execute this script

still the same problem or output just "Array" (i place allways an echo to see what is happening), trying to access the components of the array wasn't without any success.

What can you recommend me?

Thx for any help in advance.

Greets, Xen

fci
04-10-2006, 04:36 PM
did you try print_r($the_array) to see the contents of the array?

fci
04-10-2006, 04:46 PM
you could also write a wrapper for SSH and authenticate using SSH keys

Xen
04-10-2006, 05:55 PM
u're right, i forgot doing so:-)

what's a wrapper?

fci
04-10-2006, 06:47 PM
The wrapper acts as an interface between its caller and the wrapped code. This may be done for compatibility, e.g. if the wrapped code is in a different programming language or uses different calling conventions, for security, e.g. to prevent the calling program from executing certain functions, to provide a level of emulation, e.g. a DirectX API which hides the functions of the video card driver. The implication is that the wrapped code can only be accessed via the wrapper.
http://en.wikipedia.org/wiki/Wrapper

Xen
04-18-2006, 07:35 PM
how do i do that?

do you know any good tutorial etc?

thx for helping

firepages
04-18-2006, 11:55 PM
Does PHP have permissions to start and stop the server ? probably not, if you are running PHP as an apache module then the exec() gets called as the apache user (nobody/daemon/apache whatever) and you probably need root permissions.

Search this forum for sudo (assuming you have sudo) which is probably the easier way around this.