Apache user doesn't seem to get parse error output.
Posted: Tue Sep 25, 2007 4:31 am
The PHP version I use at work doesn't give me any error information back when a PHP has syntax errors but my setup at home does. So I've wrote an online syntax checker that basically uploads a file to my box then runs 'php -l <uploadedFile>' and returns the error it receives.
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?
Can anybody here offer any suggestions. I don't want a hoggy Java PHP editor with a syntax checker, which is why I've chose this route. I use a shell to do my editing so having to move files from server to desktop then load an editor and then syntax check it doesn't seem appealing.
Regards,
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,