#1  
Old 31st May 2011, 05:43
erosbk erosbk is offline
Senior Member
 
Join Date: Mar 2011
Posts: 337
Thanks: 49
Thanked 36 Times in 30 Posts
Default FCGI problem, help!!!

If my site is using mod_php, this script works perfect.

If I use FastCGI, I get an error 500 page... Is it possible that each page actually running ok in mod_php runs ok in fastcgi, or problems like this are common? please help! by the way, how can I make it work?

Thanks!

<?php
$mail= 'admin@test.com.ar';
$asunto= 'testing';
$cuerpo= 'testing from web';
$envio = mail($mail,$asunto,$cuerpo);

if($envio == true)
{
echo'Send status:<br/>Sent ok!<br/>';
}
else
{
echo'Send status:<br/>Error sending!<br/>';
}
?>

Edit: Added SuEXEC to site and it works perfectly... FastCGI+SuEXEC is a must? thanks

Edit2: my mails are being sending, with this script (FastCGI+SuEXEC) from sender: "web2@servername.domain.com". How can I change this for every website to be admin@userdomain.com (for example, would be great to us ServerAdmin as default sender!!)

Really, thanks for your help, this are the last details that I have to correct in order to launch servers into production state!

Last edited by erosbk; 31st May 2011 at 06:08.
Reply With Quote
Sponsored Links
  #2  
Old 31st May 2011, 12:21
till till is offline
Super Moderator
 
Join Date: Apr 2005
Location: Lüneburg, Germany
Posts: 35,421
Thanks: 812
Thanked 5,205 Times in 4,081 Posts
Default

Quote:
Edit: Added SuEXEC to site and it works perfectly... FastCGI+SuEXEC is a must? thanks
No. But it is required for most scripts, otherwise the scripts run under the wrong user.

Quote:
Edit2: my mails are being sending, with this script (FastCGI+SuEXEC) from sender: "web2@servername.domain.com". How can I change this for every website to be admin@userdomain.com (for example, would be great to us ServerAdmin as default sender!!)
The sender address is set automatically by php to the name of the linux system user @ the hostname of your server if no sender address is set in your script. Have you set the sender address in your scripts?
__________________
Till Brehm
--
Get ISPConfig support and the ISPConfig 3 manual from ispconfig.org.
Reply With Quote
  #3  
Old 31st May 2011, 13:43
erosbk erosbk is offline
Senior Member
 
Join Date: Mar 2011
Posts: 337
Thanks: 49
Thanked 36 Times in 30 Posts
Default

Quote:
No. But it is required for most scripts, otherwise the scripts run under the wrong user.
Then my scripts must work without suexec? why I get an error 500 without fastcgi with that simple script? (i will use suexec in everysite because what you said, but I just want to know why e500).

Quote:
The sender address is set automatically by php to the name of the linux system user @ the hostname of your server if no sender address is set in your script. Have you set the sender address in your scripts?
No, I am not setting a sender. Is there a way to change this "default sender" of php? If I set mod_php, the sender is "webmaster@userdomain.com" instead "user@hostname".

By the way, I need to restrict sender to be ONLY xxxx@samedomain.com (samedomain of the site, to avoid abuse). Is there a way to do this?

Thanks!
Reply With Quote
  #4  
Old 31st May 2011, 14:20
edge edge is offline
Moderator
 
Join Date: Dec 2005
Location: The Netherlands
Posts: 2,033
Thanks: 261
Thanked 147 Times in 128 Posts
Default

Quote:
Originally Posted by erosbk View Post
No, I am not setting a sender. Is there a way to change this "default sender" of php? If I set mod_php, the sender is "webmaster@userdomain.com" instead "user@hostname".
Add the "-f" option to your PHP mail code.
PHP Code:
mail('to@blah.com','subject!','body!','From: from@blah.com','-f from@blah.com'); 
More info @ http://php.net/manual/en/function.mail.php
__________________
Never execute code written on a Friday or a Monday.
Reply With Quote
  #5  
Old 31st May 2011, 15:00
till till is offline
Super Moderator
 
Join Date: Apr 2005
Location: Lüneburg, Germany
Posts: 35,421
Thanks: 812
Thanked 5,205 Times in 4,081 Posts
Default

Quote:
Then my scripts must work without suexec? why I get an error 500 without fastcgi with that simple script? (i will use suexec in everysite because what you said, but I just want to know why e500).
Take a look in the error.log of the website, yozu will find the error message there that explains the reason.
__________________
Till Brehm
--
Get ISPConfig support and the ISPConfig 3 manual from ispconfig.org.
Reply With Quote
  #6  
Old 31st May 2011, 15:49
erosbk erosbk is offline
Senior Member
 
Join Date: Mar 2011
Posts: 337
Thanks: 49
Thanked 36 Times in 30 Posts
Default

Quote:
Originally Posted by edge View Post
Add the "-f" option to your PHP mail code.
PHP Code:
mail('to@blah.com','subject!','body!','From: from@blah.com','-f from@blah.com'); 
More info @ http://php.net/manual/en/function.mail.php
Thank you but, I am needing to set a default sender, in case the owner of a vhost use phpmail function without a from (using, for example, the code that I wrote in the first post). Do you know how to do it? if I set a vsite with mod_php, a default address is set in the vhost file, I want to do something like it :P

Thanks in advance!
Reply With Quote
  #7  
Old 31st May 2011, 15:51
erosbk erosbk is offline
Senior Member
 
Join Date: Mar 2011
Posts: 337
Thanks: 49
Thanked 36 Times in 30 Posts
Default

Quote:
Originally Posted by till View Post
Take a look in the error.log of the website, yozu will find the error message there that explains the reason.
Thanks, the error message was:

Code:
[Tue May 31 00:37:58 2011] [warn] [client 190.18.77.3] (104)Connection reset by peer: mod_fcgid: error reading data from FastCGI server
[Tue May 31 00:37:58 2011] [error] [client 190.18.77.3] Premature end of script headers: mail.php
but, if I enable suEXEC, it works perfectly without error (always using FastCGI). Do you know why, or where to find out the answers?

Thanks for all your help
Reply With Quote
  #8  
Old 31st May 2011, 20:19
till till is offline
Super Moderator
 
Join Date: Apr 2005
Location: Lüneburg, Germany
Posts: 35,421
Thanks: 812
Thanked 5,205 Times in 4,081 Posts
 
Default

Most likely the apache userw as not allowed to read the php file as it is obnwed by the web user. fastcgi with sueexec executes php files as website user while fastcgi without suexec executes the php file as apache user.
__________________
Till Brehm
--
Get ISPConfig support and the ISPConfig 3 manual from ispconfig.org.
Reply With Quote
The Following User Says Thank You to till For This Useful Post:
erosbk (1st June 2011)
Reply

Bookmarks

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

Similar Threads
Thread Thread Starter Forum Replies Last Post
Strange email problem for one of my domains... any help appreciated paulrobert_a Installation/Configuration 5 9th August 2010 14:15
ISPConfig3 Mail Warn Errors reason8 General 3 25th November 2009 13:58
BIG Problem Postfix issue admins Installation/Configuration 11 13th November 2009 10:05
postfix mysql on fedora core5 igongora Installation/Configuration 7 17th April 2007 04:40
SMTP TLS Problem with Mail Client dschmid Installation/Configuration 1 9th December 2005 01:56


All times are GMT +2. The time now is 02:23.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2014, vBulletin Solutions, Inc.