PHP Email Piping not working with cPanel 11

celliott

Well-Known Member
Jan 2, 2006
459
0
166
United Kingdom
Hi,

We use email piping for WHMCS on our server by setting up a forwarder on our support address to: php -q /home/usernme/public_html/clients/pipe/pipe.php

Since updating to cPanel 11 the piped emails are all blank, no body information, no subject or from address.

We are running CentOS 4.4 with the latest CURRENT build.

Any suggestions?
 

AlexV.

Well-Known Member
Jun 15, 2006
212
1
168
Sorry to hear you are having issues with such feature.

If you could please open a support ticket, we will look into it accordingly and discuss it with the QA and Developers as needed.
 

AlexV.

Well-Known Member
Jun 15, 2006
212
1
168
pcsmart24:

We received your ticket and we are currently investigating as well as the correlation with WHMCS.

We will update you as soon as more relevant information is available.
 

klutsh

Registered
Jul 8, 2005
2
0
151
Is there ant way of manually adding the pipe command to a config file, rather than using the cPanel UI?
 

tsgroup

Member
Nov 28, 2006
6
0
151
Hi all sorry to revive an old post but i have the exact same problem as mentioned in the first post, does anyone know if there is a way of sorting this out i have also scanned the whmcs forums and cant find anything about it there im using CPanel 11.

Thanks
Jay
 

pcsmart24

Member
Feb 15, 2006
12
0
151
Hi,

This is the reply that WHMCS managed to sort out with cPanel.

Hi,

Well the actual issues, despite cPanel claiming they hadn't changed anything, was that a piping file is now required to have a hashbang line at the top of it - "#!/usr/local/bin/php", the readfile command we were using before to read in the email from the server has been blocked and fopen now has to be used, and the file permissions have to be set 755 or cPanel blocks the pipe from occuring. Although CHMOD to 755 has always been suggested, it was not required until cPanel 11.

Regards,

Matt

Hope that helps

Jason
 

tsgroup

Member
Nov 28, 2006
6
0
151
Hi,

This is the reply that WHMCS managed to sort out with cPanel.

Hi,

Well the actual issues, despite cPanel claiming they hadn't changed anything, was that a piping file is now required to have a hashbang line at the top of it - "#!/usr/local/bin/php", the readfile command we were using before to read in the email from the server has been blocked and fopen now has to be used, and the file permissions have to be set 755 or cPanel blocks the pipe from occuring. Although CHMOD to 755 has always been suggested, it was not required until cPanel 11.

Regards,

Matt

Hope that helps

Jason
Hi thanks for that i added the line to the pipe.php and now i get this error log in the pipe directory. I placed "#!/usr/local/bin/php" without quotes at very top of the file then i placed it under <php at top of file none of them made any difference.
Code:
[24-Jun-2007 19:44:32] PHP Parse error:  syntax error, unexpected T_IF in /home/USERNAME/public_html/order/pipe/pipe.php on line 34
The email i get when i send to the address is as foillows
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/USERNAME/public_html/order/pipe/pipe.php
generated by support @ xxxxx.com
The following text was generated during the delivery attempt:
------ pipe to |/home/USERNAME/public_html/order/pipe/pipe.php
generated by support @ xxxxx.com
------ PHP Warning: Unknown(): Unable to load dynamic library './php_curl.so' - ./php_curl.so: cannot open shared object file: No such file or directory in Unknown on line 0

Any ideas or can you tell me exactly where you placed the HashBang also just so you dont need to ask line 34 is actually commented out text in the pipe.php file so shouldnt even effect it.
thanks for your help
Jay
 

maever

Active Member
Sep 26, 2005
31
0
156
I hate to be the one reviving such an old topic but I feel that my contribution is of great value since this is still a very common issue.

for those of you who DO NOT have root access and therefor cannot access the /etc/valliasses directory.

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:
#!/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).
 

cappac

Member
Nov 30, 2007
9
0
51
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