LoginSignup
9
12

More than 5 years have passed since last update.

WindowsローカルのPHPでSSL有効化

Last updated at Posted at 2017-10-11

SSLを有効化したつもりになっていたので、設定の備忘録です。

やりたいこと

Windowsのローカル環境でLaravel5.5を起動する

環境

  • Windows10
  • Apache/2.4.27 (Win64)
  • PHP 7.1.10 (cli) (built: Sep 26 2017 20:04:32) ( ZTS MSVC14 (Visual C++ 2015) x64 )
  • Laravel Framework 5.5.14

問題

laravelを起動後、http://localhost/にアクセスしてみると
PHP Warning: PHP Startup: Unable to load dynamic library 'C:/php71/ext\\php_openssl.dll
と出ているので、php.iniでextensionが有効化されていることを確認。

php.ini
extension=php_openssl.dll

よく書かれている、extension_dirも確認。

php.ini
; On windows:
extension_dir = "C:/php71/ext"

この状態でApacheを再起動するも、Aapcheのerror.logを見ると、

PHP Warning:  PHP Startup: Unable to load dynamic library 'C:/php71/ext\\php_openssl.dll' - \xef\xbf\xbd\xef\xbf\xbd\xef\xbf\xbd\xcc\x83I\xef\xbf\xbdy\xef\xbf\xbd\xef\xbf\xbd\xef\xbf\xbd[\xef\xbf\xbde\xef\xbf\xbdB\xef\xbf\xbd\xef\xbf\xbd\xef\xbf\xbdO \xef\xbf\xbdV\xef\xbf\xbdX\xef\xbf\xbde\xef\xbf\xbd\xef\xbf\xbd\xef\xbf\xbd\xc5\x82\xef\xbf\xbd %1 \xef\xbf\xbd\xcd\x8e\xef\xbf\xbd\xef\xbf\xbds\xef\xbf\xbd\xef\xbf\xbd\xef\xbf\xbd\xef\xbf\xbd\xdc\x82\xef\xbf\xbd\xef\xbf\xbd\xef\xbf\xbdB\r\n in Unknown on line 0

デコードしてみたが文字化けてしまったので、メッセージの解析は挫折…

やったこと

OpenSSLの使い方を調べてみました。
PHPのフォルダ直下にある、ssleay32.dlllibeay32.dllをパスの通ってるディレクトリに置かないと行けないらしく、
今回はC:\Windows\System32にコピー。

Apacheを再起動するとエラーが出ず、表示されました。
image.png

9
12
1

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
9
12