PHP5在浏览器中不起作用,但在Bash中不起作用

I try to save a text into a file with PHP. But this code works in bash

sudo php5 send.php

fine but when I try to create the File via Browser it does nothing.

<?php
   error_reporting(E_ALL);
   $file = '/absolute/path/to/file/text.txt';;
   file_put_contents($file,"Hello World");
?>

Thanks for help

So I changed the permissions to the folder and now it works fine:

sudo chown www-data:www-data -R /var/www/html/*

I don't know if there are any safety problems but this Server is just in lan