SA-MP Forums

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

Reply
 
Thread Tools Display Modes
Old 21/05/2010, 09:31 PM   #1
aimless
Little Clucker
 
Join Date: May 2010
Posts: 2
Reputation: 0
Default PHP Start

Code:
	private function Run($sCommand)
	{
		require('auth.php');
		require('GetServer.php');
		shell_exec('cd /var/www/sampservers/s1');
    shell_exec('./samp02Xsvr');
		shell_exec('cd'.GAME_DIRECTORY.'');
		shell_exec('nohup'.GAME_BIN_NAME.'&');
		exec('nohup'.GAME_BIN_NAME.'&');
		$sCommand = 'cmd /C '.$sCommand;
		$oShell = new COM("WScript.Shell");
		$oShell->Run($sCommand, 0, false);
		$aTemp = array();
    proc_close(proc_open('cd'.GAME_DIRECTORY.'nohup ./s1 &', array(), $aTemp));
		return true;
	}
Code:
	public function Start()
	{
		require('auth.php');
		require('GetServer.php');
		shell_exec('cd /var/www/sampservers/s1');
    shell_exec('./samp02Xsvr');
		shell_exec('cd'.GAME_DIRECTORY.'');
		shell_exec('nohup'.GAME_BIN_NAME.'&');
		exec('nohup'.GAME_BIN_NAME.'&');
		$this->Run('start /D "'.GAME_DIRECTORY.'" /B '.GAME_BIN_NAME);
$aTemp = array();
proc_close(proc_open('cd'.GAME_DIRECTORY.'nohup ./s1 &', array(), $aTemp));
		return true;
	}
Code:
	public function Stop()
	{
		require('auth.php');
		require('GetServer.php');
		$this->Run('taskkill /F /IM '.GAME_BIN_NAME.' /T');
		return true;
	}
I'm trying to start the server.

Here's what I've got so far but it does not seem to start the server, it's a variation of Nitok's Starter code (http://forum.sa-mp.com/index.php?topic=138092.0) - I took the Windows version of the code and add bits into it to see if I could start SA-MP on a linux server but.. phail.

Any help...?
aimless is offline   Reply With Quote
Old 22/05/2010, 09:33 AM   #2
Westie
Gangsta
 
Westie's Avatar
 
Join Date: Jul 2009
Posts: 859
Reputation: 63
Default Re: PHP Start

Technically it's a variation of my code, but oh well.

You would need separate scopes for Linux and Windows (Linux doesn't have the COM object). And don't use shell_exec();


...and I don't appreciate people adding my MSN without asking.
Westie is offline   Reply With Quote
Old 22/05/2010, 06:20 PM   #3
aimless
Little Clucker
 
Join Date: May 2010
Posts: 2
Reputation: 0
Default Re: PHP Start

If I can't use shell_exec() what function do I use to start the server?
aimless 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
Where to start? SampStunta Server Support 2 25/04/2010 07:32 AM
start ietso Client Support 2 11/03/2010 12:50 AM
Where to start.. Dolph Server Support 14 04/03/2010 01:41 PM
I don't know even how to start! Hot Help Archive 0 07/09/2009 03:05 PM
Sa-Mp won't start Jonte92 Client Support 5 12/02/2009 02:12 PM


All times are GMT. The time now is 03:51 PM.


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