zoukankan      html  css  js  c++  java
  • Linux PHP7的openssl扩展安装

    Linux环境下使用PHPmailer发送邮件时,出现如下错误:

    SMTP -> ERROR: Failed to connect to server: Unable to find the socket transport "ssl" - did you forget to enable it when you configured PHP? (32690)

    出现这个问题的原因是当初编译安装PHP缺少了ssl库。

    可以重新再次编译PHP,加上--enable-openssl参数即可。

    但是如果只为了安装这一个扩展就去重新编译,未免有点麻烦,其实可以简单一点,只要安装openssl.so扩展就可以了。

        (1)找到之前编译安装PHP的安装包,或者从php的官网下载php7(本例使用php7,其他版本的PHP类似)

        (2)解压并进入文件夹 

        cd php7.0/ext/openssl

        (3)运行 phpize:

        /usr/local/php/bin/phpize

            image.png

            备注,如果出现如下错误:Cannot find config.m4.

            Make sure that you run '/usr/local/php/bin/phpize' in the top level source directory of the module

            【解决办法】cp ./config0.m4 ./config.m4 即可解决

        (4)编译和安装

        ./configure --with-openssl --with-php-config=/usr/local/php/bin/php-config
        make && make install

            image.png

        (5)然后进入最后提示的目录,查看文件如下:

            image.png

        (6)将 openssl.so 复制到PHP的扩展目录下:

        cp openssl.so /usr/local/php/include/php/ext

        (7)找到php.ini,在最后面添加如下内容:

        extension=openssl.so

        (8)重启php-fpm和nginx/apache,查看phpinfo();

        image.png

     

       

  • 相关阅读:
    P1030 求先序排列 P1305 新二叉树
    spfa
    Clairewd’s message ekmp
    Cyclic Nacklace hdu3746 kmp 最小循环节
    P1233 木棍加工 dp LIS
    P1052 过河 线性dp 路径压缩
    Best Reward 拓展kmp
    Period kmp
    Substrings kmp
    Count the string kmp
  • 原文地址:https://www.cnblogs.com/rxbook/p/9106474.html
Copyright © 2011-2022 走看看