I’ve done this script :
#!/usr/bin/php
<?php
system('whoami');
This script does belong to userName.
When I run it from a webbrowser, using the following php script:
<?php
$cmd = 'php -f "/pathtomy/programm/whoami.php"';
system($cmd);
it output _www
( I’m on a mac ).
I would like the script to output userName,
when called from the webbrowser.
Is this possible ?
I saw c++ wrapper solution on this forum,
but I don’t have the time to learn c++ yet,
so I wondered if there were other solutions.
The user the web server is running as (
_www) is the user as which any and all scripts will execute. If you want to switch to a different user, you can usesuor similar mechanisms to switch users in the command you’re executing, but that also means_wwwwill have to have permissions set up to be able to switch to that user. It’s also generally a bad idea to execute anything as another user, the web server is specifically running as_www, which should have very very limited permissions on the system, to minimize security breaches.There’s probably a better solution to do what you want to do which does not require you to switch users.