Chris
Chris

Reputation: 1131

CPanel Email Piping to PHP

I have created a pipe script in CPanel and have placed the hashbang:#!/usr/bin/php -q at the beginning of my script. The script does run and places a log of the email into a table in my DB as it should.

But...It sends an email back claiming that the email did not go through and appears as...

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 |/home/xxxxx/xxxxx.php
   generated by [email protected]

The following text was generated during the delivery attempt:

------ pipe to |/home/xxxxxx/xxxx.php
      generated by [email protected] ------

PHP Deprecated:  Directive 'magic_quotes_gpc' is deprecated in PHP 5.3 and greater in Unknown on line 0
<br />
<b>Deprecated</b>:  Directive 'magic_quotes_gpc' is deprecated in PHP 5.3 and greater in <b>Unknown</b> on line <b>0</b><br />

I have removed all private information but nothing that is relevant to my issue.

What could be my issue?

Upvotes: 3

Views: 7943

Answers (4)

mikl
mikl

Reputation: 1007

I had this problem and i found the answer here http://forums.kayako.com/threads/very-odd-piping-problem.11954/

The solution is to leave only one space break between #!/usr/bin/php -q and <?php:

Wrong way:

#!/usr/bin/php -q

<?php

Right way:

#!/usr/bin/php -q
<?php

Upvotes: 1

John Kurlak
John Kurlak

Reputation: 6680

How did you add the pipe in CPanel?

If you follow this guide: http://www.phpshare.org/articles/Piping-Incoming-Mail-with-PHP.html

It says to add the following into CPanel:

|php -q /home/phpshare/public_html/handler.php

Did you ALSO include the -q flag in CPanel as that guide describes?

Upvotes: 3

ServerTechSupport.com
ServerTechSupport.com

Reputation: 301

I think you must have upgraded your servers php version recently i.e 5.2.x to 5.3.

PHP 5.3 doesn't support magic_quotes_gpc.

So comment out or remove that line in php.ini. On cPanel server the path of php.ini is /usr/local/lib/php.ini

For commenting you should use ;.

; magic_quotes_gpc = on

Upvotes: 1

ppetree
ppetree

Reputation: 816

if your php script fails for any reason (in this case the magic quotes error) your email gets rejected (even though you may have processed the email in your script). The system "assumes" that if a script error occured then the message delivery failed.

As others have said, fix the magic quotes problem...

Upvotes: 1

Related Questions