I am trying to understand how the Linux user works and interacts with a PHP Script running on an Apache server. This question has three part to it.
I have a very simple script that prints the userinfo on screen:
$uID = posix_geteuid();
$dummy = posix_getpwuid($uID);
On Server "A" It yields this result:
[name] => apache [passwd] => x [uid] => 48 [gid] => 48 [gecos] => Apache [dir] => /var/www [shell] => /sbin/nologin
(PhpInfo shows: Server API Apache 2.0 Handler, this is a server on which I have total control. )
On Server "B" the same script yields this result:
[name] => ixj.arrowone [passwd] => x [uid] => 613764 [gid] => 15020 [gecos] => ixj.arrowone [dir] => /home/users/web/b2197/ixj.arrowone [shell] =>
(PhpInfo shows: Server API CGI. This is a hosted server on where I'm leasing space. )
What I'm seeing here is that the php.ini settings control the user that accesses the php scripts when coming in thru the WWW interface. That makes sense. Now my questions.
#1. Are there advantages/disadvantages of the user being "Apache" verses an assigned username (i.e. like on server "B")?
#2. Is there a way to change the user from within the phpScript itself or only thru the php.ini?
#3. I'm having an issue with files I upload via FTP as only being accessible when I change the permissions to 777. I'd rather not give the "world" write access, but it appears that is the only way I can do that. Does the "apache" user require "world" access to display files thru the Web browser?