After spending abut 8 hours frustrated (and growing very grumpy) :) I found a solution and wanted to share.

On my site, I use cPanel. I found a couple of posts that saved me some serious headaches so I decided to share them here to hopefully help someone else. I had a very, very basic script for email piping which at the moment really only sends an email...no parsing yet, but I kept getting delivery failure notifications....

Then I came across this post on the cpanel forum:

...I feel that my contribution is of great value since this is still a very common issue.

...

The correct steps are:
-make sure that the hashbang is actually in the top of your script and IS NOT behind your <?php tag, it has to the FIRST line of your script.

PHP Code:
#!/usr/bin/php -q
<?php
/** Code here **/
?>
-Make sure that you save the file in UNIX format
so YES there is a difference in how files are saved, programs like notepad will add a "windows newline" character which will appear as "^M" in linux.
The script will then simply crash and not do anything + bounceback.
To remove windows-enters please save your files with editplus or notepad++ (and be sure to set the file format to UNIX).

This

The script will then simply crash and not do anything + bounceback.

was exactly what was happening to me. So I did two things, I opened up Notepad++ and copied the script there, saving it and I uploaded in Ascii format with WS_FTP Pro....began getting the bounce but ALSO the script response....onto something....

So reading a bit further in that thread, I found this....

As it has been stated already: on CPanel 11 use shebang

#!/usr/local/bin/php -q

in your php file.

I got
Error in argument 1, char 3: option not found
while trying with
#!/usr/bin/php -q

Again...same issue I had been having...so I added the directory "local" and re-added the -q which I had taken out due to the error.

These two steps seem to have resolved my issues!

Also, I was not able to add | php -q in the actual forward location as my cPanel rejected the "|" pipe and simply deleted the php -q from the string...so unfortunately those solutions I had read about were not working for me.

So it basically came down to hidden characters and the way I was uploading the file...and adding in that extra "local" directory in the path. I spent close to 8 hours before I found these two things...hopefully it will be of some use to another member :)

Melanie

Recommended Answers

All 2 Replies

Just a note that some web hosts don't allow email piping (mine doesn't). For those who can do it, this should be very useful so thanks for taking the time to share it.

Just a note that some web hosts don't allow email piping (mine doesn't). For those who can do it, this should be very useful so thanks for taking the time to share it.

LOL...that was one of my first questions to my host this morning...is this even allowed? But you are right. It is not always an option. There were a couple of other threads that offered alternatives.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.