php imap get connection failed error - php

Warning: imap_open() [function.imap-open]: Couldn't open stream {imap.gmail.com:993/imap/ssl}INBOX in /home/happy/public_html/source/imap/fet_mail_from_email_add.php on line 7
can't connect: Can't connect to gmail-imap.l.google.com,993: Connection timed out
my snippet is
$mbox = imap_open("{imap.gmail.com:993/imap/ssl}INBOX",
"user#gmail.com","somesecretpassword")
or die("can't connect: " . imap_last_error());

Like the error message point out there is a network timeout/connection failure happening.
Make sure any network equipment (Firewall, router with ACL, etc ...) don't disallow to connect to the TCP port 993.
You would probably make sure you can connect from the server to Gmail server using ssh and trying with telnet first, if that test is ok try with PHP.

Related

imap google with php: couldn't open stream

I'm trying to get emails through a PHP script:
$mbox = imap_open("{imap.gmail.com:993/imap/ssl/novalidate-cert}INBOX", "username#gmail.com", "password");
But I'm constantly getting this error:
Warning: imap_open(): Couldn't open stream {imap.gmail.com:993/imap/ssl/novalidate-cert}INBOX
IMap is enabled on my Google Account.
From the server, I tried nmap -p 993 imap.gmail.com and it return that there is imap service under this address.
regards
In my case, this error is caused by the outbound proxy blocking access to port 993.

'Connection refused' in tcp socket?

So, we are coding a web chat client for our current IM, and i have one issue, socket_connect will NOT connect, and throws the "error Warning: socket_connect(): unable to connect [111]: Connection refused in /home/shadowri/public_html/zapf/personal.php on line 29" how would i get it to connect exactly, as it has to connect to the socket and send a handshake after that, then how would i get it to read every time they receive an message? i know its listening on that tcp socket, as our pc client uses it and simply connects directly then sends the handshake? am i missing something"
Either there is a firewall in the way or there is nothing listening at the IP:port you tried to connect to.

PHPMailer error: "unable to connect to :25"

When I was trying to send an email using the PHPMailer class, I had the following error:
Warning: fsockopen() [function.fsockopen]: unable to connect to :25 (No connection could be made because the target machine actively refused it. ) in C:\Users\Testing\Downloads\PHPMailer\phpmailer\class.smtp.php on line 105
Can anyone help me?
unable to connect to :25 is an indication that you forgot to enter a server address in the configuration.
Make sure you are specifying a valid SMTP server address when initializing PHPMailer.

Can't connect to my FTP server via ftp_connect()

I have some problems with ftp_connect(); I can't connect to my own FTP-server via ftp.localhost or ftp.edgren.myftp.org. I got this error message when I try to connect:
Warning: ftp_connect() [function.ftp-connect]: php_network_getaddresses: getaddrinfo failed: No such host is known. in ...
I use this code: $conn_id = ftp_connect('ftp.localhost') or die("Couldn't connect to localhost");
What's the problem? I use the basic FTP-server program Wing FTP Server to host my server.
Thanks in advance.
Try connecting to 127.0.0.1. Localhost is just an alias to that IP, so if localhost doesn't work, the IP will.

MySQL Connection String Using PHP

I am trying to connect to the database that is hosted on my server through my local machine.
my server has cPanel 11, and it is a typical shared server, powered by CentOS, PHP and MySQL installed.
to be precise i am holding the reseller account in the same server. i want to access the database between different accounts or domains.
in MySQL connection String i tried defining the domain name, and it isn't working. here is what i tried.
<?php
$link = mysql_connect('mydomain.com', 'mysql_user', 'mysql_password');
if (!$link) {
die('Could not connect: ' . mysql_error());
}
echo 'Connected successfully';
mysql_close($link);
?>
this is giving the following error
Warning: mysql_connect() [function.mysql-connect]: [2002] A connection attempt failed because the connected party did not (trying to connect via tcp://bhatkalnews.com:3306) in C:\wamp\www\test\conn.php on line 4
Warning: mysql_connect() [function.mysql-connect]: A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond. in C:\wamp\www\test\conn.php on line 4
Fatal error: Maximum execution time of 60 seconds exceeded in C:\wamp\www\test\conn.php on line 4
what do i have to define in connection string to make it work?
Firewall ?
try
telnet mydomain.com 3306
on the command line.
If that doesn't work, the connection is blocked by a firewall, most likely
Did you try adding the port explicitly:
mysql_connect('mydomain.com:3306', 'mysql_user', 'mysql_password');
or the port youre running on if not the default 3306. This of course assumes your server allows remote connections.
Also make sure the user in quest has access from the IP address youre connecting from. This isnt youre issue right now, but it may be the next question you have after you get the server to respond :-)
Please refer,
http://forums.mysql.com/read.php?52,294772
You need to add your IP address/range on Access Host list in Remote MySQL in cPanel.

Categories