Note that when PHP is called by f.e. apache or nginx instead of directly from the command line, touch() will not prefix the location of the invoking script, so the supplied filename must contain an absolute path.
With script started from /home/user/www, this will not touch "/home/user/www/somefile":
<?php
touch( 'somefile' );
?>
But this will:
<?php
touch( __DIR__ . '/somefile' );
?>