Topic: To send commands to the server

It is necessary (PHP) to send the code to the server on execution some commands. I do so:

$output = popen ("killall Xvnc", "r");
$output0 = popen ("su apache", "r");
$output1 = popen ("vncserver", "r");

I see  executions of the first command but the second and the third is not present. That I not so do