| View previous topic :: View next topic |
| Author |
Message |
sirobert
Joined: Wed Jul 21, 2010 7:37 am Posts: 2
|
Posted: Wed Jul 21, 2010 7:51 am Post subject: Project 1 - PHP coding |
|
|
I'm attempting the first php project, but the output to buffer commands arn't working. The files are still output to the command line, nothing is written to the output file. What am I doing wrong?
Thanks
Simon
<?php
function subdir_scan($dir){
$files = scandir($dir);
foreach ($files as $file){
if($file==".") continue;
if($file=="..") continue;
print "$dir/$file\n";
if(is_dir("$dir/$file")){
subdir_scan("$dir/$file");
}
}
}
chdir("..");
ob_start;
subdir_scan(".");
$output=ob_get_clean();
echo $output;
file_put_contents("output",$output);
?> |
|
| Back to top |
|
 |
bobthebob1234 LXF regular

Joined: Thu Jan 03, 2008 9:38 pm Posts: 1356 Location: A hole in a field
|
Posted: Wed Jul 21, 2010 8:31 am Post subject: Re: Project 1 - PHP coding |
|
|
| sirobert wrote: | | nothing is written to the output file. |
I assume you are talking about
| Code: |
file_put_contents("output",$output);
|
Does the user you are running the script as have permission to write to the file 'output'?
If the file 'output' doesn't exist does the user have permission to create and write a file? _________________ For certain you have to be lost to find the places that can't be found. Elseways, everyone would know where it was |
|
| Back to top |
|
 |
sirobert
Joined: Wed Jul 21, 2010 7:37 am Posts: 2
|
Posted: Wed Jul 21, 2010 10:57 am Post subject: PHP Project 1 |
|
|
yup, running the script as me and the owner and group is me. I think it might be something to do with the output buffer commands as the instructions say that the output to the screen should be suppressed if its going to the buffer.
Thanks |
|
| Back to top |
|
 |
| View previous topic :: View next topic |
|