apache - php - imap_open producing 500 Internal Server Error & no fcgid.conf file in /etc/httpd/conf.d/ folder -
i using next script access gmail php called this.php
i have regered imap not working in php imap error on myname@mydomain.com working on myname@gmail.com
i have confirmed opensll , imap extensions loaded apache.
i have confirmed file permission on file
in apache logs error is
[tue jun 17 23:42:12 2014] [warn] [client 24.120.116.118] mod_fcgid: read info timeout in 40 seconds [tue jun 17 23:42:12 2014] [error] [client 24.120.116.118] premature end of script headers: this.php [tue jun 17 23:42:12 2014] [error] [client 24.120.116.118] file not exist: /home/cesarbi1/public_html/500.shtml no matter 500. if comment out line imap_open page not 500.
is there somewhere else can errors? or can tell me whats wrong script?
<?php /* connect gmail */ $hostname = '{imap.gmail.com:993/imap/ssl}inbox'; $username = 'username@gmail.com'; $password = 'password'; /* seek connect */ $inbox = imap_open($hostname,$username,$password) or die('cannot connect email account: ' . imap_last_error()); /* grab emails */ $emails = imap_search($inbox,'unseen') or die('cannot connect email account: ' . imap_last_error()); /* if emails returned, cycle through each... */ if($emails) { /* begin output var */ $output = ''; /* set newest emails on top */ rsort($emails); /* every email... */ foreach($emails $email_number) { /* info specific email */ $overview = imap_fetch_overview($inbox,$email_number,0); $message = imap_fetchbody($inbox,$email_number,2); /* output email header info */ $output.= '<div class="toggler '.($overview[0]->seen ? 'read' : 'unread').'">'; $output.= '<span class="subject">'.$overview[0]->subject.'</span> '; $output.= '<span class="from">'.$overview[0]->from.'</span>'; $output.= '<span class="date">on '.$overview[0]->date.'</span>'; $output.= '</div>'; /* output email body */ $output.= '<div class="body">'.$message.'</div>'; } echo $output; } /* close connection */ imap_close($inbox); ?> solved update
while question of same nature of other question, other 1 not provide solution of without fcgid.conf located in /etc/httpd/conf.d/ folder. editing title more specific error.
i fixed issue adding @ end of file httpd.conf
include "/etc/httpd/conf.d/cfgid.conf" and manually created file in
/etc/httpd/conf.d/fcgid.conf and added next code worked.
<ifmodule mod_fcgid.c> fcgididletimeout 3600 fcgidprocesslifetime 3600 fcgidiotimeout 3600 fcgidbusytimeout 3600 </ifmodule>
your errors this:
[tue jun 17 23:42:12 2014] [warn] [client 24.120.116.118] mod_fcgid: read info timeout in 40 seconds [tue jun 17 23:42:12 2014] [error] [client 24.120.116.118] premature end of script headers: this.php [tue jun 17 23:42:12 2014] [error] [client 24.120.116.118] file not exist: /home/cesarbi1/public_html/500.shtml seems me error in first line:
mod_fcgid: read info timeout in 40 seconds looking @ script connecting via imap & outputting straight browser (i assume) while e-mails beingness read? well, if have moderately sized e-mail box, 40 seconds eaten pretty quickly.
so might have go fastcgi config here; assuming on linux setup:
/etc/httpd/conf.d/fcgid.conf and edit line like:
fcgidiotimeout 120 which equates 2 minutes. still way high practical web server application, should work solve issue. alter line, restart apache & test again. if on ubuntu restart apache this:
sudo service apache2 restart php apache
No comments:
Post a Comment