LiteSpeed Technologies
Download Download     Blog Blog     Wiki Wiki     Forum Forum     Store     Contact Contact    

Go Back   LiteSpeed Support Forums > External Applications > PHP > PHP mail function issue

Reply
 
Thread Tools Display Modes
  #1  
Old 03-01-2007, 09:20 AM
hugemikeyd hugemikeyd is offline
Member
 
Join Date: Mar 2006
Location: New York
Posts: 42
Default PHP mail function issue

I cannot seem to send an email message using Litespeed, but I can use the same file from the command line with success.

I am not really sure what's going on here, i feel like it may be permissions, but i tried sending as the user that Litespeed is run under and it works.

I'm hoping to get some ideas to try in here
Reply With Quote
  #2  
Old 03-01-2007, 09:37 AM
mistwang mistwang is offline
LiteSpeed Staff
 
Join Date: May 2003
Location: New Jersey
Posts: 7,590
What kind of method are you using to send email, sendmail? mail? or SMTP?
It is a PHP problem, you can use "strace" to trace the PHP process to find out what exactly causes it.
Reply With Quote
  #3  
Old 03-01-2007, 10:15 AM
hugemikeyd hugemikeyd is offline
Member
 
Join Date: Mar 2006
Location: New York
Posts: 42
Well this is the thing, i created a file using the mail function that just sends out an email to me, nothing fancy at all. If i run it from the command prompt as the user Litespeed is run as, it works just fine. I can see the email enter my qmail queue and then it goes out.

When i use the same file as a web request, the email enters my mail queue but never gets sent out.

The only difference is that i am triggering it using LSAPI rather than on the command prompt.

My PHP is compiled by me and both the CLI and LSAPI have the same exact configure setting with the exception of "--with-litespeed".

That's why i think it may be something with my configuration.
Reply With Quote
  #4  
Old 03-01-2007, 11:10 AM
mistwang mistwang is offline
LiteSpeed Staff
 
Join Date: May 2003
Location: New Jersey
Posts: 7,590
You can use the LSAPI version as the CLI one.
If the email got into the mail queue, it may not be a PHP email problem, maybe missing something in the email message itself.
Reply With Quote
  #5  
Old 03-01-2007, 11:31 AM
hugemikeyd hugemikeyd is offline
Member
 
Join Date: Mar 2006
Location: New York
Posts: 42
Nothing is missing from the email if the same file works from the command line but doesn't when accessed through a browser:

mail( 'someemail@gmail.com',
'Just testing mail from php',
'blah',
"From: \"Testing\"<test@testdomain.com>\n".
"Content-Type: text/plain; charset=\"utf-8\"\n".
"Return-path: <test@testdomain.com>"
);

I don't think it could be any simpler really, are there any settings in Litespeed that would prevent this from going through?
Reply With Quote
  #6  
Old 03-01-2007, 12:00 PM
mistwang mistwang is offline
LiteSpeed Staff
 
Join Date: May 2003
Location: New Jersey
Posts: 7,590
I think there might be something in php.ini prevent the mail function work properly. You can try CLI or LSAPI PHP from comand line using option "-c <path_to_php.ini>", see if you get the same result as run under LSWS.

For LSWS configuration, please double check process soft/hard limit and memory limit, make sure they are large enough.
Reply With Quote
  #7  
Old 03-01-2007, 12:30 PM
hugemikeyd hugemikeyd is offline
Member
 
Join Date: Mar 2006
Location: New York
Posts: 42
using the -c option from the command line still results in the email being sent.

My current options for the memory and process limits are:
Memory Soft Limit (bytes) number 100M
Memory Hard Limit (bytes) number 200M
Process Soft Limit number 200
Process Hard Limit number 200

Should they be higher?
Reply With Quote
  #8  
Old 03-01-2007, 01:15 PM
mistwang mistwang is offline
LiteSpeed Staff
 
Join Date: May 2003
Location: New Jersey
Posts: 7,590
those numbers are looking fine.
Maybe you need to set "sendmail_path" in php.ini
details are in http://us3.php.net/mail
LSWS will not pass your shell PATH environment to PHP started by it, instead, it set PATH to "/usr/bin:/bin", so a wrong "sendmail" might be used. you can set PATH in environment explicitly as well.
Reply With Quote
  #9  
Old 03-01-2007, 04:44 PM
hugemikeyd hugemikeyd is offline
Member
 
Join Date: Mar 2006
Location: New York
Posts: 42
My php.ini settings are correct:

Path to sendmail: /var/qmail/bin/sendmail

So it's a full path. I don't have a sendmail under /usr or /usr/lib
Reply With Quote
  #10  
Old 03-01-2007, 05:02 PM
mistwang mistwang is offline
LiteSpeed Staff
 
Join Date: May 2003
Location: New Jersey
Posts: 7,590
Then try set PATH environment variable to the same value as your shell, if there is other environment variables required by qmail, add them to lsphp's environment.
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -7. The time now is 02:04 PM.



- Archive - Top
© Copyright 2003-2011 LiteSpeed Technologies, Inc. All rights reserved. Privacy Policy.