Hello,
I'm running apache and using php to deliver a page. I am using a function to randomly serve a picture through a php page (/var/www/html/pf) when called as such:
PHP Code:
<?php
// open the file in a binary mode
function random_pic($dir = 'apa')
{
$files = glob($dir . '/*.*');
$file = array_rand($files);
return $files[$file];
}
$name = random_pic();
$fp = fopen($name, 'rb');
// send the right headers
header("Content-Type: image/jpeg");
header("Content-Length: " . filesize($name));
// dump the picture and stop the script
fpassthru($fp);
exit;
?>
I have granted the Apache user access to the apa folder and pictures within it and it works fine.
But now I want to replace the folder 'apa' with a symlink to a folder outside of www, more specifically /shares/bilder/Wille
I have tried reading up on it and messed around with <Directory> ans <Alias> tags in the Apache config, I've added a symlink to the /shares/bilder/Wille folder, I've set access rights on both symlink and the real folder/files but nothing works. The glob returns an empty array whatever I do.
I'm assuming I'm simply not able to set it up correctly with the correct configuration of all the above. So.. I'm hoping someone where can give me instructions on how to get it to work.
Thanks in advance!