Having trouble figuring out how to write a basic text file via PHP. Been trying for a week now but as an example below is some of the basic code I've been trying. I'm logged in via SSH using root to beagle bone black running PHP 5.4 on Debian Wheesy.
When I point my browser to the page it shows both hello world type and doesn't display an error but when I go to try to find the file I cannot (find / -name data.txt). The test PHP file is located in var/www I'm sure it's something basic that I'm missing... any insight would be appreciated.
<html>
<head>
<title>PHP Test</title>
</head>
<body>
<?php echo '<p>Hello World4</p>';
$fp = fopen('data.txt', 'w');
fwrite($fp, '1');
fwrite($fp, '23');
fclose($fp);
// the content of 'data.txt' is now 123 and not 23!
echo '<p>Hello World Again</p>';
?>
</body>
</html>