If you have the gd lib installed (check with phpinfo(); ) it's something like
//create image
$img = imagecreatetruecolor($width, $height);
//fill by iterating through your raw pixel data
imagesetpixel($img, $x, $y, $color);
//output
header("Content-Type: image/png");
imagepng($img);
//cleanup
imagedestroy($img);
EDIT
You said it was RGBA data. Assuming standard 4 bytes per channel and that your raw data is an integer array, it should be:
$pos = ($y * $width + $x) * 4 + ($headerLengthInBytes / 4);
$red = $rawImageData[$pos];
$green = $rawImageData[$pos + 1];
$blue = $rawImageData[$pos + 2];
$alpha = $rawImageData[$pos + 3];