FUDforum
Fast Uncompromising Discussions. FUDforum will get your users talking.

Home » Imported messages » comp.lang.php » Parsing mbox files with Windows Php
Show: Today's Messages :: Polls :: Message Navigator
Return to the default flat view Create a new topic Submit Reply
Re: Parsing mbox files with Windows Php [message #181717 is a reply to message #181707] Mon, 27 May 2013 15:22 Go to previous messageGo to previous message
Peter H. Coffin is currently offline  Peter H. Coffin
Messages: 245
Registered: September 2010
Karma:
Senior Member
On Sat, 25 May 2013 16:39:14 -0600, Chuck Anderson wrote:
> Peter H. Coffin wrote:
>> On Fri, 24 May 2013 15:57:14 -0600, Chuck Anderson wrote:
>>
>>> $mbox = imap_open('pathto/mboxfile', '', '') // works on *nix, but not
>>> on Windows.
>>> - Notice: Unknown: Can't open mailbox mboxfiles/Inbox: no such mailbox
>>> (errflg=2) in Unknown on line 0.
>>> (This second error is the one coming from the underlying c-client
>>> function.)
>>>
>>
>> Okay, step one: quit munging stuff around and give us the EXACT code,
>> the EXACT contents of variables involved, and the EXACT error messages.
>> You're not revealing national secrets by posting paths to filenames, and
>> what the problem is may be in what you're changing to be more general.
>>
>
> I used generic paths and filenames because I had tried several variations.
>
> I have learned that imap_open only works on a file - on a *nix web
> server - if the path to the mbox file is relative to $HOME. I have not
> found any official documentation, just forum posts saying so, and ... it
> is the only way I have been able to make it work.
>
> So, imap_open works for me (on the remote Linux host) if, and only if, I
> use:
> imap_open ('public_html/mboxfiles/Trash', '', '')
> // Trash is an mbox file I uploaded directly from my Thunderbird Profile
>
> On Windows
> c:/localhost is the document root
> c:/localhost/imap is where the Php scripts are located.
> c:/localhost/imap/mboxfiles is where the mbox file "Trash" is located
>
> I have tried:
> imap_open('localhost/imap/mboxfiles/Trash', '', ''); // equivalent of
> being relative to $HOME on *nix
> imap_open('/imap/mboxfiles/Trash', '', ''); // absolute path from
> document root
> imap_open('mboxfiles/Trash', '', ''); // relative path
> imap_open('c:/localhost/imap/mboxfiles/Trash', '', ''); // real path on disk
>
> On Windows I always get these two errors (the file path changes
> accordingly):
>
> - Warning: imap_open(): Couldn't open stream
> localhost/utilities/imap/eml/Trash in
> localhost\utilities\imap\imap_save_mbox_file.php on line 127
>
> - Notice: Unknown: Can't open mailbox
> localhost/utilities/imap/eml/Trash: no such mailbox (errflg=2) in
> Unknown on line 0
>
> I have read that the second error is coming from the c-client (errflg=2
> comes from there).

Since the error messages about whether the file can be found, maybe it's
time to investigate WHERE exactly cclient is thinking it's pointing.
Because DocumentRoot isn't necessarily the same as $HOME. And when
you're using an actual IMAP server, they're nowhere close to alike.
But %UserProfile% might be a lot closer. So where's the base of what
cclient, on Windows, on your configuration, actually pointing? You may
have to haul out a test script that does opendir()/readdir() on '/'
and see what turns up, then find what directory those things that read
out are in. Then put the mail files under there, and make sure they're
world-readable.

[...]
> I hoped someone else had cracked this nut, but I'm beginning to believe
> that it is not crackable, so .... I will probably upload the entire
> Thunderbird Mail folder structure to the remote host and try running my
> script during low traffic hours. Once I verify it has worked 100%
> (archived everything and saved the folder structure properly), I will
> not have a need to do it again.

It's crackable, but IMHO, the number of PHP instances that are running
on Windows hosts that are doing anything user-related locally pales in
comparison to the number that are using user-related stuff on unix
hosts, which pales in comparison to the number that are doing only
webby-webby stuff for non-local clients. So the number of people that
have more than an academic interest in cracking this (much less
documenting the result) is probably only a handful worldwide, and some
of those probably just said "Screw it. I'll upload the mailfiles."

--
80. If my weakest troops fail to eliminate a hero, I will send out my
best troops instead of wasting time with progressively stronger
ones as he gets closer and closer to my fortress.
--Peter Anspach's list of things to do as an Evil Overlord
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: why php echo does not show up in HTML?
Next Topic: Exhaustive memory allocation using arrays
Goto Forum:
  

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ]

Current Time: Thu Feb 20 09:46:38 GMT 2025

Total time taken to generate the page: 0.04050 seconds