The only problem is that it's only returning part of the error, which is the part I don't need. I would like it to include the line number and type of error, but it's only returning 'Errors parsing <file>'
I thought t his was due to the whole output not being stored in the variable but I ran some other system commands that have multiple line output and they display fine.
So at a guess it looks like the Apache user doesn't get the full error message, unless you can spot something in this code?
Code: Select all
<form enctype="multipart/form-data" method="POST">
<input type="hidden" name="MAX_FILE_SIZE" value="100000" />
<input name="uploadedfile" type="file" /><br />
<input type="submit" value="Upload File" />
</form>
<?php
if($_POST) {
$fName = $_FILES['uploadedfile']['name'];
$tName = $_FILES['uploadedfile']['tmp_name'];
$fSize = $_FILES['uploadedfile']['size'];
$tPath = "/var/www/html/syntaxCheck/tmp/{$fName}";
if(move_uploaded_file($tName, $tPath)) {
system("php -l {$tPath}");
}
else
echo "Didn't work";
}
Regards,