SA-MP Forums Archive
SA-MP Server Starts Up By PHP Great!... But... - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Server (https://sampforum.blast.hk/forumdisplay.php?fid=6)
+--- Forum: Server Support (https://sampforum.blast.hk/forumdisplay.php?fid=19)
+--- Thread: SA-MP Server Starts Up By PHP Great!... But... (/showthread.php?tid=284851)



SA-MP Server Starts Up By PHP Great!... But... - AustinJ - 21.09.2011

So after trying server times to get this to work correctly and configure my web server and vps it finally starts up and stays up, but the page continues to load and won't stop unless i force it to. When I force it to stop the server stay up how to I get it to stop executing the php?

Код:
<?php exec('cd /***/ ; ./samp03svr &'); ?>
Info: I am running this on lighttpd /w php on Debian.


Re: SA-MP Server Starts Up By PHP Great!... But... - Toni - 21.09.2011

I'm pretty sure you would need SSH2 not just PHP functions, correct?


Re: SA-MP Server Starts Up By PHP Great!... But... - AustinJ - 21.09.2011

I have tried ssh2 but it never works... Here is my code for that...
PHP код:
$connection ssh2_connect('***'22);
ssh2_auth_password($connection'***''***');
ssh2_exec($connection'cd /***/ ; ./samp03svr &'); 
EDIT: I have ssh2 installed. Here is a picture off my php info file.




Re: SA-MP Server Starts Up By PHP Great!... But... - Toni - 21.09.2011

You're sure your connected right...? And it's installed correctly? Maybe also try testing it by maybe doing a simpler command like maybe just ssh2_exec($connection, 'mkdir test');


Re: SA-MP Server Starts Up By PHP Great!... But... - AustinJ - 21.09.2011

PHP код:
$connection ssh2_connect('***'22);
if(
ssh2_auth_password($connection'***''***'))
{
    echo 
"Authentication Accepted.";
}
else
{
    echo 
"Authentication Denied.";
}
$stream ssh2_exec($connection'mkdir Testing'); 
I get "Authentication Accepted" when the page is executed but the directory isn't made.


Re: SA-MP Server Starts Up By PHP Great!... But... - Toni - 21.09.2011

I have pretty much no experience but would it make a difference if say instead of single quotes you used double quotes to execute commands?


Re: SA-MP Server Starts Up By PHP Great!... But... - AustinJ - 21.09.2011

That shouldn't make a difference.


Re: SA-MP Server Starts Up By PHP Great!... But... - JiHost - 21.09.2011

exec() won't stop loading in your php script as long as server is online.
Tried using nohup instead? About ssh2, make sure you installed it correctly, maybe some modules are missing.


Re: SA-MP Server Starts Up By PHP Great!... But... - robanswe - 21.09.2011

Quote:
Originally Posted by AustinJ
Посмотреть сообщение
PHP код:
$connection ssh2_connect('***'22);
if(
ssh2_auth_password($connection'***''***'))
{
    echo 
"Authentication Accepted.";
}
else
{
    echo 
"Authentication Denied.";
}
$stream ssh2_exec($connection'mkdir Testing'); 
I get "Authentication Accepted" when the page is executed but the directory isn't made.
Hmm are you sure the ssh user you login with is allowed to create new directorys in that place?


Re: SA-MP Server Starts Up By PHP Great!... But... - AustinJ - 21.09.2011

SSH2 is installed correctly. And the ssh user has full permissions.