Hi
Sorry if posted in the wrong section, I think it fits here but not 100% sure...
On my server I use a few php includes to pull content from text files (on my server) and insert that content in other pages. I use the following code to achieve this
This was working fine and all was good. However, a few days back I formatted the server and reinstalled direct admin. Now when I run the above code I get a blank page, no content is pulled even if I just set up a test directory. If I used <php></php> at the start and end instead of <? then the code just breaks. All the server settings are as they were previously so that should be fine. PHP and Open Base are turned off on all domains. When I rebuilt DA I selected option 3 from the 3 build choices menu. Would that have made any difference?
Any help would be most welcome please, I have tested everything I think it could be but still not success.
Thanks
Carl
Sorry if posted in the wrong section, I think it fits here but not 100% sure...
On my server I use a few php includes to pull content from text files (on my server) and insert that content in other pages. I use the following code to achieve this
PHP:
<?
// specify directory
$directory = "/path/to/directory";
// make a list of text file paths in directory
if ($handle = opendir($directory)) {
while (false !== ($file = readdir($handle))) {
if ($file != "." && $file != ".." && preg_match("/\.txt$/",$file)){
$file_paths[] = $directory."/".$file;
}
}
closedir($handle);
}
// randomize the file path list
shuffle($file_paths);
// and select the first path
$textfile = $file_paths[0];
// do something with selected path such as output the contents...
echo file_get_contents($textfile);
?>
This was working fine and all was good. However, a few days back I formatted the server and reinstalled direct admin. Now when I run the above code I get a blank page, no content is pulled even if I just set up a test directory. If I used <php></php> at the start and end instead of <? then the code just breaks. All the server settings are as they were previously so that should be fine. PHP and Open Base are turned off on all domains. When I rebuilt DA I selected option 3 from the 3 build choices menu. Would that have made any difference?
Any help would be most welcome please, I have tested everything I think it could be but still not success.
Thanks
Carl