When some user access the php script, such process is run
with the uid of the apache/httpd process always, CentOS
for example has user 'apache' for the default pages,
other distros uses 'httpd','www' or something similar.
There is no difference if the user access your script
from the same machine or from another machine through
the network, the process is always executed with the
If your script needs to write some information, it needs
write permissions to the directory for the "apache" user.