Results 1 to 8 of 8
  1. #1

    * Open mails with PHP trough IMAP at PLESK vps

    Hi All,

    I'm running a default Plesk 11.0 setup at a VPS on CentOS 6.

    Now I want to fetch my email with PHP using the IMAP protocol using the php function imap_open.

    According to Plesk the IMAP/POP3 Server (Courier-IMAP) service is running okay and the firewall setting for IMAP is: IMAP (mail retrieval) Allow incoming from all.

    I've tried all the possible connection strings to connect from PHP such as "{localhost:143}INBOX" and "{localhost:143/novalidate-cert}INBOX", but all they give the error "Warning: imap_open(): Couldn't open stream {localhost:143/imap/notls}INBOX in ** on line 20 Can't connect to localhost,143: Permission denied Notice: Unknown: Can't connect to localhost,143: Permission denied (errflg=1) in Unknown on line 0 Notice: Unknown: Can't connect to localhost,143: Permission denied (errflg=2) in Unknown on line 0"

    Does anybody have any idea on what I can do to make this work ?

    Many thanks,
    Dirk

  2. #2
    UPDATE: if I run the same PHP script from my local computer it is working as it should be . So it doesn't seem to be IMAP settings on my VPS but some sort of PHP restriction on my VPS...

    On step closer but not yet fixed. Who can help me with the next step?

    Thanks,
    Dirk

  3. #3
    Join Date
    Apr 2005
    Location
    Cochin
    Posts
    2,446
    1. I am assuming that you have php_imap enabled already
    2. The error is " Can't connect to localhost,143: Permission denied" . Did you try a "telnet localhost 143" from within the server ?

    It doesn't look like a php restriction to me
    Sam
    Supportlobby.com - Expertise in Windows/Linux server support, IaaS and PaaS Management
    Spiralbean.com - Custom Software Development
    Email: exec @ activelobby.net | Skype: unni_active

  4. #4
    Hi activelobby4u,

    Thank you for your response.

    1: php_imap is installed.
    2: telnet localhost 143 is working and returns:
    * OK [CAPABILITY IMAP4rev1 UIDPLUS CHILDREN NAMESPACE THREAD=ORDEREDSUBJECT THREAD=REFERENCES SORT QUOTA AUTH=CRAM-MD5 AUTH=PLAIN IDLE ACL ACL2=UNION STARTTLS]

    As said before I'm able to succesfully use imap_open to connect to the same mailserver from my home computer. So I think it's some php or maybe a firewall setting that blocks it if I move the script to my webserver.

    Do you have any further suggestions ?

    Many thanks,
    Dirk

  5. #5
    I did an extra check for the firewall now, if I run nmap -sS -O 127.0.0.1 on the server than it returns that port 110, 143, 993 and 995 are all open . So to me it doesn't seems to be the firewall? Which only leaves the PHP settings...

    Thanks,
    Dirk

  6. #6
    Join Date
    Apr 2005
    Location
    Cochin
    Posts
    2,446
    Did you authenticate using an account in the script ?
    Sam
    Supportlobby.com - Expertise in Windows/Linux server support, IaaS and PaaS Management
    Spiralbean.com - Custom Software Development
    Email: exec @ activelobby.net | Skype: unni_active

  7. #7
    Hi Activelobby4u,

    Yes I provided a valid account in imap_open.

    I just found out something else which seems to be the same problem as well, if I do a simple file_get_contents("some-website"); I get a Warning: file_get_contents (some-site): failed to open stream: Permission denied in /var/www/vhosts/**** as well!

    So it seems to be a more general problem on my server than something specific with imap_open !

    I don't know why I'm getting this error, since the httpdocs directory has chmod 777 and in php upload_tmp_dir has no value and allow_url_fopen is on...

    Any suggestions on this?

    Many thanks,
    Dirk

  8. #8
    Just found a solution!

    It seems to be something with the plesk license !

    in puty: setenforce 0 did the job.

    For more explaination see this page (in Dutch, but you should be able to read with google translate):
    https://www.transip.nl/vragen/544-up...aar-problemen/

    Thanks for the help!

Similar Threads

  1. how to open php file from win2k3 vps?
    By fsdgw563573 in forum VPS Hosting
    Replies: 21
    Last Post: 02-20-2013, 07:03 AM
  2. Replies: 7
    Last Post: 11-19-2008, 11:17 AM
  3. Plesk - IMAP
    By NuPixel in forum Dedicated Server
    Replies: 7
    Last Post: 01-10-2008, 02:41 PM
  4. IMAP : Couldn't open stream
    By goolex in forum Hosting Security and Technology
    Replies: 1
    Last Post: 04-08-2007, 08:12 AM
  5. IMAP in Plesk
    By Hijabulous in forum Hosting Software and Control Panels
    Replies: 0
    Last Post: 02-08-2001, 02:04 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •