web-dev-qa-db-ja.com

ソケットトランスポート「ssl」が見つかりません-PHPの構成時に有効にするのを忘れましたか?

私はこのエラーをどうにかして何時間もグーグルで調べています。 this topicからのすべての解決策を試してみましたが、運はありません。 <? phpinfo(); ?>(IISの代わりにAppserverを使用している唯一の違い)は、SSLに対して実現されたものを何も表示しません。他に何を試してみるべきですか?

完全なエラーメッセージ:

<b>Warning</b>:  fsockopen() [<a href='function.fsockopen'>function.fsockopen</a>]: unable to connect to ssl://smtp.gmail.com:465 (Unable to find the socket transport &quot;ssl&quot; - did you forget to enable it when you configured PHP?) in <b>C:\AppServ\www\webgitz\test\class.smtp.php</b> on line <b>122</b><br />
SMTP -> ERROR: Failed to connect to server: Unable to find the socket transport "ssl" - did you forget to enable it when you configured PHP? (27010016)

およびコード:

<?php 

require_once "validation.php";

require_once "PHPMailer.php";


require_once "class.smtp.php";

$email= "[email protected]";

$mail = new PHPMailer();
$mail->IsSMTP();
$mail->SMTPAuth   = true; // enable SMTP authentication
$mail->Port       =465;                    // set the SMTP server port
$mail->Host = "smtp.gmail.com"; // GMAIL's SMTP server
$mail->SMTPDebug = 2;
$mail->SMTPSecure = 'ssl';
$mail->Username   = "[email protected]"; // GMAIL username
$mail->Password   = "*********"; // GMAIL password
$mail->AddReplyTo("[email protected]","AAAA"); // Reply email address
$mail->From = "[email protected]";
$mail->FromName = "...."; // Name to appear once the email is sent
$mail->Subject = "...."; // Email's subject
$mail->Body = "Hello World,<br />This is the HTML BODY<br />"; //HTML Body
$mail->AltBody = "..."; // optional, commentA out and test
$mail->WordWrap = 50; // set Word wrap
$mail->MsgHTML($msg); // [optional] Send body email as HTML
$mail->AddAddress("$email", "fooo");  // email address of recipient
$mail->IsHTML(true); // [optional] send as HTML

if(!$mail->Send()) echo 'ok'; else echo 'error';    
?>
21
Jack

これがある場合は、php.iniファイルを確認してください。

;extension=php_openssl.dll

に変更する

extension=php_openssl.dll

その後、Appserverが提供するコントロールパネルを使用するか、システムのコントロールパネルのサービスウィンドウを使用して、Apacheを再起動してください。

また、php_openssl.dllがシステムが到達できるフォルダー上にあることを確認してください。多くの人は、dllの場所の問題をC:\ windowsまたはC:\ windows\system32にコピーすることで解決します。それは必要ではありませんが。

その後、phpinfoを使用してファイルを実行し、有効になっていることを確認します。

私はどこかを読んで、それを特定することはできません、そのような種類の沼のいくつかのインストールには複数のphp.iniがありますが、実際にアクティブなのは1つだけです、間違ったものを編集した可能性がありますか?

40
PatomaS

適切な答えは、行を置き換えることです

;extension=php_openssl.dll

php.iniファイルで

extension=php_openssl.dll

extension=php_openssl.dllファイルでphp.iniが見つからない場合は、ファイルに次の行を追加するだけです。

extension=php_openssl.dll

これは動作するはずです!

2
Dawson

Sslで同様のエラーが何時間もありました。

私のために働いたのは、php\libeay32.dllphp\ssleay32.dllおよびphp\ext\php_openssl.dllをphpディレクトリからApache2.2\binディレクトリにコピーすることでした。次に、Apacheを再起動します。

1
emanresu

一部の人々にとって、これらのソリューションは機能しません。

私にとっての解決策はこれでした:dll libeay32.dllとssleay32.dllをサーバーのbinディレクトリにコピーします-Apache。

ソリューションは、次のコメントで提案します: http://php.net/manual/fa/openssl.installation.php

エラーログを見ると、問題はdllをロードしてサーバーディレクトリに置くことが唯一の方法であることがわかった。

0
Daniel