shadowjig Posted January 26, 2011 Share Posted January 26, 2011 I am running Apache with the PHP module installed on Debian Linux. My goal is to launch a binary in a background process and then feed it commands via fifo. The binary I need to launch has a config file which lives in the home directory of the apache user (in my case the user name apache is started with is www-data). www-data's home dir was the web root so I changed it to /home/www-data. I also change the shell from /bin/sh to /bin/bash for www-data. Neither of these changes are present when I load a php file from a browser. This script: <?php echo "User: " . exec('whoami') . "<br>"; echo "Shell: " . exec('ps -p $$ | grep sh') . "<br>"; ?> Outputs this: User: www-data Shell: 9179 ? 00:00:00 sh Also if I execute the binary it does seem to read the config file which is in the www-data users directory. I have set the home dir and the web root to be owned by www-data and it's read and writeable. How do I get php to execute the binary so it has access to the users home directory and uses the bash shell? Are there any other ways to launch and control a binary on a unix system via php? Link to comment https://forums.phpfreaks.com/topic/225761-executecontrol-binary-from-php/ Share on other sites More sharing options...
trq Posted January 28, 2011 Share Posted January 28, 2011 The www-data user cannot login and therefor does not get a home directory. Why would they need one? Link to comment https://forums.phpfreaks.com/topic/225761-executecontrol-binary-from-php/#findComment-1166394 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.