I am trying to set up a forwarder to pipe to php script.
The entry in the forwarder list is as follow:
prakash@domain.com to |home5/nadlani1/public_html/parsing.php
The opening of the script is
#!/usr/bin/php -q
<?php
and the beginning of the bounce back message is:
This message was created automatically by mail delivery software.
A message that you sent could not be delivered to one or more of its
recipients. This is a permanent error. The following address(es) failed:
pipe to |/home5/nadlani1/public_html/parsing.php
generated by prakash@domain.com
The following text was generated during the delivery attempt:
------ pipe to |/home5/nadlani1/public_html/parsing.php
generated by prakash@domain.com ------
Error in argument 1, char 3: option not found <
Usage: php [-q] [-h] [-s] [-v] [-i] [-f <file>]
php <file> [args...]
-a Run interactively
-b <address:port>|<port> Bind Path for external FASTCGI Server mode
-C Do not chdir to the script's directory
-c <path>|<file> Look for php.ini file in this directory
-n No php.ini file will be used
-d foo[=bar] Define INI entry foo with value 'bar'
-e Generate extended information for debugger/profiler
-f <file> Parse <file>. Implies `-q'
-h This help
-i PHP information
-l Syntax check only (lint)
-m Show compiled in modules
-q Quiet-mode. Suppress HTTP Header output.
-s Display colour syntax highlighted source.
-v Version number
-w Display source with stripped comments and whitespace.
-z <file> Load Zend extension <file>.
-T <count> Measure execution time of script repeated <count> times.
If I remove the -q I simply get a bounce back with the following header:
This message was created automatically by mail delivery software.
A message that you sent could not be delivered to one or more of its
recipients. This is a permanent error. The following address(es) failed:
pipe to |/home5/nadlani1/public_html/parsing.php
generated by prakash@domain.com
local delivery failed
Attached file is parsing.php file for reference. parsing.php
Error in argument 1, char 3: option not found
Usage: php [-q] [-h] [-s] [-v] [-i] [-f <file>]
php <file> [args...]
-a Run interactively
-b <address:port>|<port> Bind Path for external FASTCGI Server mode
-C Do not chdir to the script's directory
-c <path>|<file> Look for php.ini file in this directory
-n No php.ini file will be used
-d foo[=bar] Define INI entry foo with value 'bar'
-e Generate extended information for debugger/profiler
-f <file> Parse <file>. Implies `-q'
-h This help
-i PHP information
-l Syntax check only (lint)
-m Show compiled in modules
-q Quiet-mode. Suppress HTTP Header output.
-s Display colour syntax highlighted source.
-v Version number
-w Display source with stripped comments and whitespace.
-z <file> Load Zend extension <file>.
-T <count> Measure execution time of script repeated <count> times.
Ray Paseur
This seems to show that you have a closing PHP tag. That is AntiPHPractice #13. Try removing it - there may be invisible whitespace after it and that may be enough to cause the bounce.
While adding Forwarders from Cpanel :: added Pipe like this
|/usr/bin/php -q /home5/nadlani1/public_html/parsing.php
"/usr/bin/php -q" part should match to the first line of parsing.php page .. Now it executed perfectly.
Thanks
gr8gonzo
Strange. It sounds like it was treating your PHP script as if it were a list of commands rather than a PHP script itself. But in most scenarios, that wouldn't happen - if you didn't have executable permissions on the file, then it would just throw an error about permissions, not try to run the file as if it were a bash script or something...
Glad it works now, though.
Ray Paseur
I don't think you want to have this script in the web root (public_html) directory. Just a thought...
You would reduce the risk of accidental (unwanted) execution. As long as you have a "dummy" script that does not change the data model, it's no problem. But presumably some day the pipe script will be doing something meaningful -- perhaps storing data, or making data base updates. If you do not have a public URL, you add a little better security. Without the URL, the chances that the script was started by something other than an email are greatly reduced. But if the script has a URL and someone discovers it, your applications becomes a target-rich environment for all kinds of mischief.
Starquest321
ASKER
I've requested that this question be closed as follows:
Accepted answer: 0 points for Starquest321's comment #a39657183
Assisted answer: 250 points for gr8gonzo's comment #a39656759
Assisted answer: 250 points for Ray_Paseur's comment #a39656791