genebom Posted April 27, 2011 Share Posted April 27, 2011 Hi - I'm not sure if this is the right place for this. If not can someone please point me to an appropriate place? That said, I've been trying to invoke a php script from the postfix mta. the Email is delivered just fine to 'localuser', the postfix log shows no errors, yet there is no indication that the script ever ran. All the script does is create several files and ouput some text to them. Works fine from the console. Anyone have any ideas how to go forward troubleshooting this? Thanks, Gene Details follow below ... Postfix runs as user 'postfix'. Script permissions are: -rwxrwxrwx 1 postfix localuser 236 Apr 27 08:47 test4.php From /etc/mail/aliases: testuser: localuser, "|/usr/local/bin/php -q /home/localuser/testmail/test4.php" I've also tried: testuser: localuser, "/home/localuser/testmail/test4.php" with #!/usr/local/bin/php as the first line in the php script. The following is from Postfix's log file (Times & other irrelevant junk removed): brightstar postfix/local[39848]: 8645B385: to=<localuser@domain.net>, orig_to=<testuser@brightstar.domain.net>, relay=local, delay=0.19, delays=0.16/0.01/0/0.02, dsn=2.0.0, status=sent (delivered to mailbox) brightstar postfix/local[39848]: 8645B385: to=<testuser@brightstar.domain.net>, relay=local, delay=0.31, delays=0.16/0.01/0/0.14, dsn=2.0.0, status=sent (delivered to command: /usr/local/bin/php -q /home/localuser/testmail/test4.php) brightstar postfix/qmgr[1017]: 8645B385: removed The script: <?php $pta = fopen('pointa', 'w'); fputs($pta,"Success pta\n"); fclose($pta); $ptb = fopen('pointb', 'w'); fputs($ptb,"Success ptb\n"); fclose($ptb); $ptc = fopen('pointc', 'w'); fputs($ptc,"Success ptc\n"); fclose($ptc); ?> Quote Link to comment https://forums.phpfreaks.com/topic/234862-php-script-invoked-from-postfix-doesnt-appear-to-run/ Share on other sites More sharing options...
genebom Posted April 28, 2011 Author Share Posted April 28, 2011 Problem Solved. When the script was invoked, it was running in another (postfix's) directory. I specified a full pathname for each of the files and voila. Success. Quote Link to comment https://forums.phpfreaks.com/topic/234862-php-script-invoked-from-postfix-doesnt-appear-to-run/#findComment-1207540 Share on other sites More sharing options...
genebom Posted April 28, 2011 Author Share Posted April 28, 2011 Problem Solved. When the script was invoked, it was running in another (postfix's) directory. I specified a full pathname for each of the files and voila. Success. Quote Link to comment https://forums.phpfreaks.com/topic/234862-php-script-invoked-from-postfix-doesnt-appear-to-run/#findComment-1207541 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.