kiruthika Posted March 5, 2007 Share Posted March 5, 2007 hi all, using few fn like exec and system we can execute unix command inside php program. all those unix commands works fine, if php is executed from the command prompt. but if same program is executed from browser(apache server), esp unix output redirection command is not working.... pl do help thanks in advance Link to comment https://forums.phpfreaks.com/topic/41254-execution-of-unix-output-redirection-command-in-php-run-in-browser/ Share on other sites More sharing options...
effigy Posted March 5, 2007 Share Posted March 5, 2007 Please post your code. Link to comment https://forums.phpfreaks.com/topic/41254-execution-of-unix-output-redirection-command-in-php-run-in-browser/#findComment-200002 Share on other sites More sharing options...
kiruthika Posted March 6, 2007 Author Share Posted March 6, 2007 #!/www/php/php <?php echo system('whoami'); system('ls > test.txt'); exec('ls > test1.txt'); ?> the file test1.txt is generated if php program is run in command prompt. but if the same program is run in internet explorer browser, it doesnot generate any files thanks for reply Link to comment https://forums.phpfreaks.com/topic/41254-execution-of-unix-output-redirection-command-in-php-run-in-browser/#findComment-200519 Share on other sites More sharing options...
effigy Posted March 6, 2007 Share Posted March 6, 2007 What are the file's owner, group, and permissions? From which directory are you running the file on the command line? What is this directory's owner, group, and permissions? What user and group is Apache running as? Link to comment https://forums.phpfreaks.com/topic/41254-execution-of-unix-output-redirection-command-in-php-run-in-browser/#findComment-200787 Share on other sites More sharing options...
kiruthika Posted March 7, 2007 Author Share Posted March 7, 2007 apache server is root user.... the file is in another user.. not root.... file has read, write, permission in user mode but not in root Link to comment https://forums.phpfreaks.com/topic/41254-execution-of-unix-output-redirection-command-in-php-run-in-browser/#findComment-201437 Share on other sites More sharing options...
kiruthika Posted March 7, 2007 Author Share Posted March 7, 2007 Now it's working fine. I have changed the directory permission, working fine. Thanks for your help. Link to comment https://forums.phpfreaks.com/topic/41254-execution-of-unix-output-redirection-command-in-php-run-in-browser/#findComment-201470 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.