I'm testing php scripts on my web server. I'm using a basic fopen / fwrite to write data to file. The following scripts works perfectly in public_html/ but fails to work in folders above "I'm trying in /test/"
centOS with WHM/cPanel, latest.
<?php
$fp = fopen('lidn.sh', 'w');
fwrite($fp, 'Cats chase mice');
fclose($fp);
?>
This works fine. However:
<?php
$fp = fopen('/test/lidn.sh', 'w');
fwrite($fp, 'Cats chase mice');
fclose($fp);
?>
doesn't write anything to file.
I need php to output data to a ".sh" file, so having it inside public_html would, I think, be a gigantic security flaw.
The goal is to securely output data to a ".sh" via PHP