IMAP functions on Apache

Problems with the Windows version of XAMPP, questions, comments, and anything related.

IMAP functions on Apache

Postby andreagrimandi » 06. January 2013 21:19

Hi all,

I'm an italian student and I'm trying to develop a php mail client. It's from a long time that I still having issues to visualize the e-mail's list from my INBOX folder. Time ago i solved this problem by modify one file (I don't remember which one now) to allow imap functions to work from my Apache. Googling, I've found to modify something in php.ini or in sendmail.ini, i tried, but it was not what i need.

What happends:

It returns a white page. No errors. Nothing. It happens when I insert (by using a form) my username (xxx@xxx.xxx), password and click the button to send the informations to the imap server. I've checked the cryptography (SSL, ecc..) the port number, of course, but it seems to be all right.

I've simplified my code from OOP to theese few lines to make more simple for you to understand what I'm gonna do:

cnf.php - configurations file.

Code: Select all
<?

$username = "my@account.mail";
$password = "my_passw";
$server = "imap.provider.com";
$conn = @imap_open("{".$server.":port/cryptography}INBOX",$username, $password);

?>


index.php - it should shows the INBOX folder.

Code: Select all
<?php

set_time_limit(120);
@include 'cnf.php';
$headers = @imap_headers($conn);
$var = "0";

if ($headers == 0) {

  echo "Nessun messaggio in arrivo.<br />\n";

}

else {

  while (@list ($k, $val) = @each ($headers)) {

    $var = $var+1;
    $f_over = @imap_fetch_overview($conn, $var, 0);

    while(@list($k, $v) = @each($f_over)) {

      echo "<b>Sent by:</b> ".$v->from."<br>\n
            <b>Object:</b>" .$v->subject."<br>\n
            <b>Date:</b> ".$v->date."<br />\n
            <a href=\"show.php?id=".$var."\">Read</a> ::                               // don't care about this
            <a href=\"delete.php?id=".$var."\">Delete</a><br /><br />\n";       // don't care about this too

    }

  }

}

@imap_close($conn);

?>


More informations:

I have the latest version of xampp;
Xampp is running on Windows 8 Professional 64;
I'm developing using PHP5;
I'm testing with my gmail's account;



Hope theese informations are sufficient.

Thank you. Have a nice evening.
andreagrimandi
 
Posts: 3
Joined: 06. January 2013 20:38
Operating System: Windows 8

Re: IMAP functions on Apache

Postby Altrea » 06. January 2013 21:23

Hi andreagrimandi,

Are you using XAMPP 1.8.1? Then you should not use PHPs short open tag <? to begin a php block. Instead use the full version <?php

best wishes,
Altrea
We don't provide any support via personal channels like PM, email, Skype, TeamViewer!

It's like porn for programmers 8)
User avatar
Altrea
AF Moderator
 
Posts: 11935
Joined: 17. August 2009 13:05
XAMPP version: several
Operating System: Windows 11 Pro x64

Re: IMAP functions on Apache

Postby andreagrimandi » 06. January 2013 21:37

Hi Altea,

you're right, I'm using 1.8.1. It's a small uncatched particular. Fixed! But I think that's not the solution cause my issue persist. In the meanwhile I'm trying to understand something more about.

Thank you. Have a nice evening.
andreagrimandi
 
Posts: 3
Joined: 06. January 2013 20:38
Operating System: Windows 8

Re: IMAP functions on Apache

Postby Altrea » 06. January 2013 21:48

So you are still getting a white screen of death?

The next steps would be to switch on PHPs error reporting by placing three lines at the very top of your php file:
Code: Select all
error_reporting(-1);
ini_set('display_errors', '1');
ini_set('display_startup_errors', '1');


But this is just the first half of showing debugging information. You need to get rid of all @ in front of your functions, because they will hide error messages fully (which is very bad style) and you need to add error functions where they are missing (e.g. imap_errors to show occuring imap errors).

Maybe a look into your \xampp\apache\logs\error.log and \xampp\php\logs\php_error_log will help too.

best wishes,
Altrea
We don't provide any support via personal channels like PM, email, Skype, TeamViewer!

It's like porn for programmers 8)
User avatar
Altrea
AF Moderator
 
Posts: 11935
Joined: 17. August 2009 13:05
XAMPP version: several
Operating System: Windows 11 Pro x64

Re: IMAP functions on Apache

Postby andreagrimandi » 06. January 2013 22:02

Dear Altrea,

thanks for you help! What you've write upper it "coincidently" solves another problem that I was looking for. But didn't care much in this time, it was a secondary pboblem. So, thanks twice!

I've solved by get rid of ";" in front of...

Code: Select all
extension=php_imap.dll


... in php.ini. It didn't load imap modules.

Now all works as it should!

Thanks again. Have a VERY nice evening.
andreagrimandi
 
Posts: 3
Joined: 06. January 2013 20:38
Operating System: Windows 8

Re: IMAP functions on Apache

Postby Altrea » 06. January 2013 22:05

Have fun with XAMPP and all that stuff 8)
We don't provide any support via personal channels like PM, email, Skype, TeamViewer!

It's like porn for programmers 8)
User avatar
Altrea
AF Moderator
 
Posts: 11935
Joined: 17. August 2009 13:05
XAMPP version: several
Operating System: Windows 11 Pro x64


Return to XAMPP for Windows

Who is online

Users browsing this forum: No registered users and 123 guests