This will allow you to run a command for any user, including those that don’t have set shells. This is particularly useful for testing a command as the Apache user.

The syntax is as follows:
su -s $SHELL $USER -c “$COMMAND

Example:
su -s /bin/sh apache -c "/usr/bin/php /var/www/html/myphpfile.php"

Advertisements