[Tool/Web/Other] [PHP] starting the server with php
#1

Ok, im having no luck with this and its making me frustrated, im trying to make a php panel to start stop and restart the server and when it starts, it says i haven't changed the pass and i have....

This is the code im using:
Код:
		$Command = "j:\\SAMPSERVER\\samp-server.exe";
			$Shell = new COM("WScript.Shell");
			$output = $Shell->Exec($Command)->StdOut->ReadAll;
			echo '<textarea name="" cols="70" rows="15">'.$output.'</textarea>';
and this is the output:

Код:
----------
Loaded log file: "server_log.txt".
----------

SA:MP Dedicated Server
----------------------
v0.2X, ©2005-2008 SA:MP Team

Unable to exec file 'server.cfg'.
Error: Your password must be changed from the default password, please change it.
Anyone know why this is happening and how to stop it?

Thanks.
Reply
#2

is your password is server.cfg "changeme"? you need to change it.
Reply
#3

read.

Quote:

it says i haven't changed the pass and i have....

Edit: also i know it works because if i manually click on the server exe, it starts fine...
Reply
#4

Its because its not reading from the CFG, from what i remember, but i cant exactly remember how i fixed it.

But you got to link it somehow xD
Reply
#5

Quote:
Originally Posted by Mrkrabz
Its because its not reading from the CFG, from what i remember, but i cant exactly remember how i fixed it.

But you got to link it somehow xD
How can you link it, SA-MP server loads it. It can't be loaded externally..
Reply
#6

Quote:
Originally Posted by Norn
Quote:
Originally Posted by Mrkrabz
Its because its not reading from the CFG, from what i remember, but i cant exactly remember how i fixed it.

But you got to link it somehow xD
How can you link it, SA-MP server loads it. It can't be loaded externally..
That's what i don't understand, i cant remember what i did :<
Reply
#7

I just got (almost) the same problem. I'm able to execute the executable file, but it gives me the lines, that had been mentioned above, as an output. Any suggestions?

For those that care, it's java code, here the (relavant) lines:
pawn Код:
Process proc=null;
Runtime rt=Runtime.GetRuntime();
               
proc=rt.getRuntime().exec("C:\\Samp\\sampserver.exe");
The code works so far, but I get the output that has been mentioned above.
Thanks in advance.
Reply
#8

had this problem too
would be nice to see how it's to be fixed
Reply
#9

I had the same problem on linux, but i think it both is caused by the same thing.
When you start the server like this, the current working directory will be the php root dir, and not the server dir. So the server tries to find the server.cfg in the php root, but doesnt find one, this is why it gives the error.
You will have to use "cd /server_dir" first or override the working directory in another way.
Reply
#10

Quote:
Originally Posted by Mauzen
Посмотреть сообщение
I had the same problem on linux, but i think it both is caused by the same thing.
When you start the server like this, the current working directory will be the php root dir, and not the server dir. So the server tries to find the server.cfg in the php root, but doesnt find one, this is why it gives the error.
You will have to use "cd /server_dir" first or override the working directory in another way.
Well, I changed the working directory if I did not make any mistakes, but the problem still exists.

Again, for those who care, here the (relevant) code:
pawn Код:
directory=input;
System.setProperty("user.dir", directory);
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)