0

SRCDS (ソース ゲーム エンジンの専用サーバー) を起動できないというトラブルシューティングの一環として、他の実行可能ファイル (具体的には Chrome と Firefox) を起動してみることにしました。ただし、どちらも起動されませんでした。ページは読み込まれましたが (SRCDS の場合のようにハングしませんでした)、Windows タスク マネージャーを確認すると、プロセスが実際に起動されることはありませんでした。$output は長さ 0 の配列で、$return_var は 1 です (実際に発生しているエラーに関する情報はありません。

私が使用するコードは次のとおりです(systemまたはpassthruの代わりに使用しても変化はありませんexec):

<?php
// Save the current working directory, then set it to SRCDS' directory
$old_path = getcwd();
chdir("C:/Users/Johan/Desktop/SteamCMD/tf2/");

// Launch SRCDS. Only the 3rd exec allows the page to load.
//$tmp = exec("srcds -console -game tf +map ctf_2fort 2>&1",$output,$output2);
//$tmp = exec("srcds -console -game tf +map ctf_2fort >> tmp.txt",$output,$output2);
$tmp = exec("srcds -console -game tf +map ctf_2fort 1>/dev/null/ 2/&1",$output,$output2);
echo "<p>SRCDS Output: ".sizeof($output)."</p>";
echo "<p>SRCDS Output2: ".$output2."</p>";

// Test execution of other files
// test.bat echoes %time%
$tmp2 = exec("test.bat");
echo $tmp2;
// Trying to launch another executable
chdir("C:\Program Files (x86)\Mozilla Firefox");
$tmp2 = exec("firefox", $output, $output2);
echo $tmp2;
echo "<p>FF Output:".sizeof($output)."</p>";
echo "<p>FF Output2:".$output2."</p>";

// End
chdir($old_path);
echo "Done.";
?>

これは以下を出力します:

SRCDS Output: 0

SRCDS Output2: 1

0:47:59,79
FF Output:0

FF Output2:1

Done.

私の質問は、これには何か理由がありますか? 私はこれを間違ってやっていますか?

4

1 に答える 1