Jump to content

use of the exec() and or proc_open() function.


fusioneko

Recommended Posts

<?php
f($_POST['startup']){
	if(!$online){
		//$A1 = array();
		//exec($servpath."khyller-server.exe") or die("<BR>Server Startup MSG - <Font color=red>Cannot find Server</font>");
		//proc_open("call C:\Server\blanked\release\khyller-server.exe", $A1,$A2,$A3);
	}
}
?>

I'm first trying to get them to work at all just do something first. but with no success  I even sued or die and all I get is die D: Is it impossible or am I just dumb? I know I did this one, But I don't know how.

 

Edit to add php color.. my eyes were hurting in blackness.

Link to comment
Share on other sites

<?php
require_once("config.php");
if($_GET['page']=="Checkserv"){
$up = fsockopen($servip, $servPort, $errno, $errstr, 1);// or die("Server Connection:<Font color=red><B>FAILED</B></Font>");
if($up){
	echo "<BR>Server <Font color=green>Online</Font>";
	$online = 1;
} else {
	echo "<BR>Server <Font color=red>Offline</Font>";
	$online = 0;
}
if($_POST['startup']){
	if(!$online){
		$descriptorspec = array(
0 => array("pipe", "r"),
1 => array("pipe", "w"),
2 => array("file", "error.txt", "a")
);
		$pipes = null;
		$cwd = $servpath;
		$env = null;
		$ooption = array("Context");
		//exec($servpath."khyller-server.exe") or die("<BR>Server Startup MSG - <Font color=red>Cannot find Server</font>");
		$process = proc_open("khyller-server.exe", $descriptorspec,$pipes,$cwd,$env, $ooption);


	}
}
if(!$online){
	echo "<form action=Admin.php?page=Checkserv method=post><BR>";
	echo "<input type=submit name=startup value=StartServer></form>";
} else {
	//
}
}
?>

 

So far I got an understanding how to use proc_open, but I wanna keep it open, any idea to make it so php doesn't hang?

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.