email pipe problem

I’ve set up the email alias below:

user -> Program php -q /home/domain/pipes/mypipe/pipe.php

Email sent to user@domain.com should be piped to the /home/domain/pipes/mypipe/pipe.php file.

How ever, I get the following message:

Command died with status 1: “php -q
/home/domain/pipes/mypipe/pipe.php”. Command output: Could not open
input file: /home/domain/pipes/mypipe/pipe.php

The file destination is correct. The file is there. I’ve chmod the pipe.php file to 755 and got the same result. The “pipes” and “mypipe” folder are also chmod to 755.

I’m not sure what I’m doing wrong here, and I have successfully piped email before with Virtualmin. I’m running CentOS 6.0 (Final) with Virtualmin 3.92.gpl GPL.

Everything I see in my log files are telling me the same message (as above).

that command uses the php-cli
while ioncube loader is set in your php.ini and phpinfo will show you that it works and so your WHMCS script for instance will work
it doesnt work for commands using php-cli

What i did is use CURL, like so: curl http://domain.tld/clients/pipe/pop.php
and set that as a cron for every 5 minutes

I had searched a long time as to how to change the php-cli configuration but I never found out. So I moved on and start using curl. You can also use wget in the same manner

I created a .forward file and placed it in the users email dir, /home/client/homes/user

It had to contain 2 lines. The first line would send the email to the users box as normal (took me awhile to figure out this was necessary), and starts with a back slash. The second one sends the email to the script (has to start with a pipe).

\user-domain.com #Send mail to regular user (else gets forwarded instead and bypasses script)

|/home/domain/public_html/cron.php #Script processing

At the top of cron.php, it has a shebang, also with the full path to php. It also has proper permissions for executing the file AND “nobody” needed to be the owner of that one file, since the email daemon is the one actually accessing it.

#!/usr/bin/php5

<?php ...regular script ?>

Another thing you might try with what you’re doing is to enter the full path to php in the command.

/full/path/to/php -q /home/domain/pipes/mypipe/pipe.php

This is the only thing that worked!!! Thank you so much.