Register for your free account! | Forgot your password?

Go Back   elitepvpers > Coders Den > Web Development
You last visited: Today at 07:56

  • Please register to post and access all features, it's quick, easy and FREE!

Advertisement



Linux + PHP + Shell

Discussion on Linux + PHP + Shell within the Web Development forum part of the Coders Den category.

Reply
 
Old   #1

 
~ JWonderpig ~'s Avatar
 
elite*gold: 60
Join Date: Sep 2013
Posts: 1,427
Received Thanks: 248
Linux + PHP + Shell

Hallo,
ich habe heut angefangen mich mit Linux zu beschäftigen.

Ich habe nur ein kleines Problem:

Ich habe mir mal aus Spaß einen TS auf meinem vServer installiert - klappt alles. Mit einer PHP Datei möchte ich den Server start/stoppen können.
Dazu nutze ich diesen Code:
PHP Code:
$sh shell_exec("sh /link-zu-ordner/ts3server_startscript.sh stop");
print_r($sh); 
Wenn der Server läuft, wird mir dieser Text ausgegeben:
Code:
Stopping the TeamSpeak 3 serverdone
Jedoch wird der Server nicht gestoppt.

Wenn ich jedoch in Putty die Datei mit
Code:
php stop.php
aufrufe, wird der Server gestoppt. Wieso funktioniert das nicht bei einem Aufruf des Skriptes?

mfg
Caiv


sry, falls das eine Noobfrage ist
~ JWonderpig ~ is offline  
Old 02/14/2015, 00:26   #2
 
xinternet's Avatar
 
elite*gold: 0
Join Date: Jun 2013
Posts: 53
Received Thanks: 14
also verstehe ich das richtig? :

du hast eine stop.php die fährt den server runter wenn du sie über putty ausführst, aber nicht wenn du im browser executest?

evtl. hast du nicht die richten rechte für ts3server_startscript.sh gesetzt?

gruß
xinternet is offline  
Old 02/14/2015, 00:40   #3

 
~ JWonderpig ~'s Avatar
 
elite*gold: 60
Join Date: Sep 2013
Posts: 1,427
Received Thanks: 248
Ja, das stimmt. Die Datei hat die Rechte "755".
In der Datei "sudoers" habe ich noch dieses hinzugefügt, hat aber auch nichts gebracht.
Code:
www-data ALL=(ALL:ALL) ALL
~ JWonderpig ~ is offline  
Old 02/14/2015, 03:31   #4
dotCom
 
Devsome's Avatar
 
elite*gold: 9842
The Black Market: 107/0/0
Join Date: Mar 2009
Posts: 16,845
Received Thanks: 4,675
probier mal ein 'sudo' vor deinem command.
Notfalls mit
Devsome is offline  
Old 02/14/2015, 14:19   #5

 
~ JWonderpig ~'s Avatar
 
elite*gold: 60
Join Date: Sep 2013
Posts: 1,427
Received Thanks: 248
PHP Code:
system("sudo sh /..../ts3server_startscript.sh stop"); 
funktioniert nicht, wenn ich es via PHP mache.
Wenn ich nur den "Shell-Teil" via Putty in dem Ordner ausführe, wo auch die PHP Datei ist, wird nach einem PW gefragt. Liegt es daran, dass es via PHP nicht geht?
Muss ich evtl. in sudoers-Datei noch irgendwas mit nopassword oder so hinzufügen? Habe da gestern was gelesen, kann mich aber nicht mehr erinnern
~ JWonderpig ~ is offline  
Old 02/14/2015, 15:07   #6
dotCom
 
Devsome's Avatar
 
elite*gold: 9842
The Black Market: 107/0/0
Join Date: Mar 2009
Posts: 16,845
Received Thanks: 4,675
Quote:
Originally Posted by Caiv View Post
PHP Code:
system("sudo sh /..../ts3server_startscript.sh stop"); 
funktioniert nicht, wenn ich es via PHP mache.
Wenn ich nur den "Shell-Teil" via Putty in dem Ordner ausführe, wo auch die PHP Datei ist, wird nach einem PW gefragt. Liegt es daran, dass es via PHP nicht geht?
Muss ich evtl. in sudoers-Datei noch irgendwas mit nopassword oder so hinzufügen? Habe da gestern was gelesen, kann mich aber nicht mehr erinnern
Ist der Pfad auch richtig ;o ?
Probier doch einfach mal

system('ls'); oder so aus
Devsome is offline  
Old 02/14/2015, 15:10   #7

 
~ JWonderpig ~'s Avatar
 
elite*gold: 60
Join Date: Sep 2013
Posts: 1,427
Received Thanks: 248
Ja, hab den Pfad nur rausgenommen, da er so lang ist.
Wenn ich system('ls'); nutze, werden mir Datein korrekt angezeigt. Wenn ich sudo davor schreibe wird mir nur 1 angezeigt.

#edit: Habe es nun hinbekommen. Musste etwas in der sudoers Datei ändern
~ JWonderpig ~ is offline  
Reply


Similar Threads Similar Threads
Big Release Skype IP Resoulver IP STresser HTML code Stealer UDP Shell TCP Shell and
01/31/2014 - Coders Trading - 5 Replies
Hello and Welcome to our Website. We Released the Hacking Tool i-NetTool's on our Website at the Button (i-NetTool Release V2) You can choose at the Form for an Free & Premium Version The Free Version have 3 Funtions & the Premium Version 7. After Payed i will send u the Username and Password. Note: We only accept Paysafecard's Premium Version cost: 10€ Free Version : 0€ Selled Times: 11
Warrock auf Linux ? (Kennt ihr auch andere Games für Linux)
09/11/2011 - WarRock - 7 Replies
Hallo, kann man Warrock auf Linux spielen ? Wenn nein kennt ihr Spiele genau wie Warrock die auch auf Linux gehen?
Silkroad Shell Shell
01/16/2006 - Silkroad Online - 23 Replies
I've found a new Silkroad bot, but the bot is in Chinese/Korean, so we need help to translate it and get it work... Download



All times are GMT +1. The time now is 07:56.


Powered by vBulletin®
Copyright ©2000 - 2026, Jelsoft Enterprises Ltd.
SEO by vBSEO ©2011, Crawlability, Inc.
This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

Support | Contact Us | FAQ | Advertising | Privacy Policy | Terms of Service | Abuse
Copyright ©2026 elitepvpers All Rights Reserved.