Ironboy500[MM] Posted September 7, 2010 Posted September 7, 2010 Hello! I am trying to start my server using ssh2 connection in PHP. PHP succefully connects but I can't start my server. I'm using this code: ssh2_exec($connection, "cd /Hosting/MTA/Server34; nohup ./mta-server34"); but it simply isn't starting my server. If I try to execute same command via putty, server starts succesfully! So any ideas why I can run it via PHP? Please Help. Thanks.
0 dzek (varez) Posted September 7, 2010 Posted September 7, 2010 prepare a .sh file for starting server, and simply run it (like /home/MyUser/start-mta.sh) edit: i dont know ssh2_exec (why not just exec?) - but there should be way to get the output after execution of command - maybe you will see whats wrong Multi theft auto tools - replace cars and peds, move your map or compile your Lua files online! programista php rzeszów Need free webhosting for your small site? PM me. Need help with portforwarding? PM me. Do not PM me asking for help with scripting. Having problems with port forwarding? Send me pm, I can do whole thing for you using TeamViewer (already helped about 20 people, no worries)!
0 Ironboy500[MM] Posted September 7, 2010 Author Posted September 7, 2010 I already made control panel for SAMP Servers, also using ssh2 connections and it is working normally. ssh2_exec($connection, "cd /Hosting/SAMP/Server2; nohup ./samp03svr2 &"); Any more ideas? Note: I am using Debian Lenny
0 dzek (varez) Posted September 7, 2010 Posted September 7, 2010 I gave you two ideas (.sh, getting output to look for errors) and it seems like you havent used any.. Multi theft auto tools - replace cars and peds, move your map or compile your Lua files online! programista php rzeszów Need free webhosting for your small site? PM me. Need help with portforwarding? PM me. Do not PM me asking for help with scripting. Having problems with port forwarding? Send me pm, I can do whole thing for you using TeamViewer (already helped about 20 people, no worries)!
0 MTA Team ccw Posted September 9, 2010 MTA Team Posted September 9, 2010 You seem to be missing the '&' at the end of the line in the MTA version. Also, to prevent excessive log size, it is advisable to use the -t option when using nohup: nohup ./mta-server -t &
Question
Ironboy500[MM]
Hello! I am trying to start my server using ssh2 connection in PHP. PHP succefully connects but I can't start my server. I'm using this code:
but it simply isn't starting my server.
If I try to execute same command via putty, server starts succesfully!
So any ideas why I can run it via PHP? Please Help.
Thanks.
4 answers to this question
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now