Originally posted by cs-cam
The user hasn't been setup with a shell by the looks of it. Post the output of this command:
You'll need to run it as root but that uses sed to chop out everything we don't need which may include an encrypted password. This will only show us the login shell and if my guess is right then you just need to change the end of this line to read /bin/bash
/etc/passwd | grep www-data | sed -e "s/.*://g"
All right, I solved it.
The issue was a little bit more complicated than that.
/bin/bash had weird permissions: (was not executable but by root user)
Having changed them with
chmod o+rx /bin/bash
changes the error code returned by system("id", $ret_code) invoked in php, from 127 to 126.
That should, from "path not found", to "command was not executable".
Then I discovered that the whole bin/ and /usr/bin/ directories had weird permissions (group ownler couldn't execute nor read).
Giving read and execute permissions to all the commands solved the issue.
I guess it had to do with the plesk installation.
By the way, running
cat /etc/passwd | grep www-data | sed -e "s/.*://g"
since usually there's no need to assign a shell to apache users.
And letting the user have /bin/false as a shell does not stop php from running shell commands through exec.
Thanks anyway for your help.