PHP/Apache runs as which user on Ubuntu Server

Solution 1:

The user that runs apache/php is www-data.
Run sudo chown -R www-data:www-data /var/www/deploy.log to make the file editable by the web server.
The other files you want to perform operations on also need to be writable by the webserver.