SA-MP Forums

Go Back   SA-MP Forums > SA-MP Server > Server Support

Reply
 
Thread Tools Display Modes
Old 10/05/2009, 02:05 PM   #1
d123
Little Clucker
 
Join Date: Jun 2008
Posts: 5
Reputation: 0
Default [PHP] How to start / stop Linux Server

Hi.
Im tryin 2 make a Control Panel for SAMP with PHP. I use Linux.

I got this functions:
Code:
	function StopServer(){
		echo shell_exec('pkill -f samp02Xsvr');
		echo "<br />";
	}
	function StartServer(){
		echo shell_exec('/opt/samp/start.sh &');
		echo "<br />";
	}
But it just doesnt work. No error. Nothin.

I'm usin lampp with php5. Do i need to change something in the configuration of lampp or php? If yes, what?

or is my code just wrong?


P.s. Startin' server manual with start.sh works.
d123 is offline   Reply With Quote
Old 10/05/2009, 07:41 PM   #2
KingJ
Huge Clucker
 
Join Date: Feb 2008
Location: UK
Posts: 365
Reputation: 64
Default Re: [PHP] How to start / stop Linux Server

Take off the echo, echo means that it will output that rather than executing it.
__________________
KINGJ.NET Game Servers is now owned by SmartBytes LLC. Click here for more information!
KingJ is offline   Reply With Quote
Old 10/05/2009, 08:19 PM   #3
d123
Little Clucker
 
Join Date: Jun 2008
Posts: 5
Reputation: 0
Default Re: [PHP] How to start / stop Linux Server

Sounds strange, cause shell_exec gives back the output from that function. And the function gives back output also without echo. i'll try also if i know that it can't be because of that
d123 is offline   Reply With Quote
Old 10/05/2009, 08:21 PM   #4
KingJ
Huge Clucker
 
Join Date: Feb 2008
Location: UK
Posts: 365
Reputation: 64
Default Re: [PHP] How to start / stop Linux Server

The function itself may also echo stuff back (such as the passed command) but you must remove the echo.

In addition, you must call the StartServer / StopServer function for it to actually execute that code.
__________________
KINGJ.NET Game Servers is now owned by SmartBytes LLC. Click here for more information!
KingJ is offline   Reply With Quote
Old 10/05/2009, 08:37 PM   #5
d123
Little Clucker
 
Join Date: Jun 2008
Posts: 5
Reputation: 0
Default Re: [PHP] How to start / stop Linux Server

Lol I know, im not stupid.

I just wrote the functions. of course i call em. Thats not the whole Script

http://php.net/shell_exec

the function doesnt echo sth itsel. it returns the output.
d123 is offline   Reply With Quote
Old 11/05/2009, 06:09 AM   #6
Woet
Gangsta
 
Join Date: Oct 2006
Posts: 518
Reputation: 18
Default Re: [PHP] How to start / stop Linux Server

Quote:
Originally Posted by d123
Hi.
Im tryin 2 make a Control Panel for SAMP with PHP. I use Linux.

I got this functions:
Code:
	function StopServer(){
		echo shell_exec('pkill -f samp02Xsvr');
		echo "<br />";
	}
	function StartServer(){
		echo shell_exec('/opt/samp/start.sh &');
		echo "<br />";
	}
But it just doesnt work. No error. Nothin.

I'm usin lampp with php5. Do i need to change something in the configuration of lampp or php? If yes, what?

or is my code just wrong?


P.s. Startin' server manual with start.sh works.
Do not ever run the servers under apache, this means it's insecure, especially when doing shared hosting (multiple users on 1 server).
Always run every server under it's own shell.

Quote:
Originally Posted by KingJ
Take off the echo, echo means that it will output that rather than executing it.
No, echo will of course execute it too, what else does it have to output?
Woet is offline   Reply With Quote
Old 11/05/2009, 09:00 AM   #7
d123
Little Clucker
 
Join Date: Jun 2008
Posts: 5
Reputation: 0
Default Re: [PHP] How to start / stop Linux Server

I'm the only one who uses the Apache.
On the Server just is 1 Samp Server, 1 CSS Server and Apache.
And the Apache was just installed for the control panel for SAMP.

Hm But how to fix the problem, that it doesn't work?
d123 is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Linux Server FFS Will not start, keeps restarting Jason_Borne420 Server Support 18 27/08/2013 10:48 AM
problem on linux server wont start oOhossamOo Server Support 3 23/05/2010 02:53 AM
Server won't start on linux | Help needed ASAP KKashimia Server Support 3 16/11/2009 06:00 PM
[Tool/Web/Other] [PHP] Create an Start/Stop functions for more one server carlino1994 Server Support 1 29/06/2009 06:00 PM
Linux server problem- Wont start. xxonlinexx Server Support 9 29/12/2008 07:35 PM


All times are GMT. The time now is 06:09 AM.


Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.