I\'m relatively new to configuring Apache.
I have a PHP script that writes a JSON file based on values retrieved from $_GET.
$_GET
You can try to set the permissions with
chmod function for php and set your directory to /var/www there you have normally enough permissions.