View Full Version : Unable to find socket transport ssl while using PHPMailer

08-01-2008, 12:20 PM
Hi folks,

I keep getting the following message when I try to run a php script trying to send email through gmail:

Warning: fsockopen() [function.fsockopen]: unable to connect to ssl://smtp.gmail.com:465 (Unable to find the socket transport "ssl" - did you forget to enable it when you configured PHP?) in C:\phpmailer\class.smtp.php on line 124
Mailer Error: SMTP Error: Could not connect to SMTP host.

The common solution on the web seems to be to uncomment the php_openssl.dll extension in php.ini but I've already done that and restarted my Apche webserver with no luck. I should add that stream_get_transports() only returns tcp and udp. Can someone please help? Here is the PHP script I'm using:


$mail= new PHPMailer();
$mail->Host = "ssl://smtp.gmail.com";
$mail->Port = 465;
$mail->IsSMTP(); // send via SMTP
$mail->SMTPAuth = true; // turn on SMTP authentication
$mail->Username = "satsujin@gmail.com"; // SMTP username
$mail->Password = "passwd"; // SMTP password
$webmaster_email = "satsujin@gmail.com"; //Reply to this email ID
$email="anoopm@shabiagroup.com"; // Recipients email ID
$name="AnoopM"; // Recipient's name
$mail->From = $webmaster_email;
$mail->FromName = "Satsujin";
$mail->WordWrap = 50; // set word wrap
//$mail->AddAttachment("/var/tmp/file.tar.gz"); // attachment
//$mail->AddAttachment("/tmp/image.jpg", "new.jpg"); // attachment
$mail->IsHTML(true); // send as HTML
$mail->Subject = "This is the subject";
$mail->Body = "Hi,
This is the HTML BODY "; //HTML Body
$mail->AltBody = "This is the body when user views in plain text format"; //Text Body
echo "Mailer Error: " . $mail->ErrorInfo;
echo "Message has been sent";

08-01-2008, 02:21 PM
Use a phpinfo(); statement in a .php file to check if the openssl extension actually loaded.

08-01-2008, 02:35 PM
Hmm the Apache environment SERVER_SOFTWARE section has this:

Apache/2.2.9 (Win32) DAV/2 mod_ssl/2.2.9 OpenSSL/0.9.8h mod_autoindex_color PHP/5.2.6

but OpenSSL itself doesnt seem to have a section in the phpinfo() list. Any idea why? IT's specified as an extension in php.ini and the dll exists in the extension directories.

08-01-2008, 02:55 PM
Check your web server error log file for related errors. If there is no error related to openssl, then it is likely the first possibility in the following. If there is an error about not being able to load a .dll, the it is like the second possibility in the following.

Two possibilities come to mind -

The php.ini that you are changing is not the one that php is using, or

The auxiliary .dll file that openssl uses - libeay32.dll is either not present or it is not present in a folder that is on the Windows PATH statement. This file is usually in the php folder and the normal method of installing php is to add the php folder to the Windows PATH statement (reboot your computer to get any changes made to the Windows PATH statement to take effect.)

08-01-2008, 03:43 PM
hmm you were right. My libeay32.dll was in my C:\xampp\php folder which was not in the PATH variable. However, I added that to the variable and reset my computer with the results still the same. I'm pretty sure i'm editing the right php.ini ( both that file and php5.ini in my php folder have that extension active) but is there some way to be sure? Or do I need to add some files to the Windows\System32 dir?

08-01-2008, 04:13 PM
The phpinfo() output contains a line in the first section that states what php.ini is getting loaded -

Loaded Configuration File xxxxxxxx

08-01-2008, 04:28 PM
Thank you, thank you, thank you! I was editing the php.ini in xampp/php but the one being used was in xampp/apache/bin. Phew! Finally....It was just lack of knowledge on my part but thank you again for leading me to the answer.

EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum