• 欢迎访问magento4you博客,我们提供magento建站、技术咨询、IT运维、支持培训、二次开发服务及模板定制,联系QQ:283475615
  • Magento入门教程 二次开发 模板定制 联系QQ:283475615
  • magento运营 SEO SEM 数字营销 广告竞价 联系QQ:283475615
  • 如果您觉得本站对你有帮助,那么赶紧使用Ctrl+D 收藏吧!

PHP编译安装openssl拓展

magento教程 magento4you 4年前 (2017-05-11) 1079次浏览

magento smtp 服务,需要开启openssl支持,不然smtp pro插件没用,会报错。

编译安装openssl拓展

首先进入PHP源码目录下的拓展目录中的openssl目录,拷贝config0.m4config.m4

<code><span class="pun">[</span><span class="pln">shebnowei@localhost php</span><span class="pun">]</span><span class="pln">$ cd php</span><span class="pun">-</span><span class="lit">5.6</span><span class="pun">.</span><span class="lit">28</span><span class="pun">/</span><span class="pln">ext</span><span class="pun">/</span><span class="pln">openssl</span><span class="pun">/</span>
<span class="pun">[</span><span class="pln">shebnowei@localhost openssl</span><span class="pun">]</span><span class="pln">$ ls
config0</span><span class="pun">.</span><span class="pln">m4  CREDITS    openssl</span><span class="pun">.</span><span class="pln">dsp  php_openssl</span><span class="pun">.</span><span class="pln">h  tests
config</span><span class="pun">.</span><span class="pln">w32  openssl</span><span class="pun">.</span><span class="pln">c  openssl</span><span class="pun">.</span><span class="pln">mak  README         xp_ssl</span><span class="pun">.</span><span class="pln">c
</span><span class="pun">[</span><span class="pln">shebnowei@localhost openssl</span><span class="pun">]</span><span class="pln">$ cp config0</span><span class="pun">.</span><span class="pln">m4 config</span><span class="pun">.</span><span class="pln">m4
</span><span class="pun">[</span><span class="pln">shebnowei@localhost openssl</span><span class="pun">]</span><span class="pln">$ ls
config0</span><span class="pun">.</span><span class="pln">m4  config</span><span class="pun">.</span><span class="pln">w32  openssl</span><span class="pun">.</span><span class="pln">c    openssl</span><span class="pun">.</span><span class="pln">mak    README  xp_ssl</span><span class="pun">.</span><span class="pln">c
config</span><span class="pun">.</span><span class="pln">m4   CREDITS     openssl</span><span class="pun">.</span><span class="pln">dsp  php_openssl</span><span class="pun">.</span><span class="pln">h  tests</span></code>

之后执行phpize命令(phpize是用来扩展PHP扩展模块的,位于PHP安装目录的bin下),phpize执行成功后会在这个目录生成configure脚本,然后进行配置、编译安装:

<code><span class="pln">phpize
</span><span class="pun">./</span><span class="pln">configure </span><span class="pun">--</span><span class="kwd">with</span><span class="pun">-</span><span class="pln">openssl </span><span class="pun">--</span><span class="kwd">with</span><span class="pun">-</span><span class="pln">php</span><span class="pun">-</span><span class="pln">config</span><span class="pun">=</span><span class="str">/usr/</span><span class="kwd">local</span><span class="pun">/</span><span class="pln">php</span><span class="pun">/</span><span class="pln">bin</span><span class="pun">/</span><span class="pln">php</span><span class="pun">-</span><span class="pln">config
make
sudo make install</span></code>

配置PHP.ini

打开PHP的配置文件php.ini:

<code><span class="pln">sudo vim </span><span class="pun">/</span><span class="pln">usr</span><span class="pun">/</span><span class="kwd">local</span><span class="pun">/</span><span class="pln">php</span><span class="pun">/</span><span class="pln">etc</span><span class="pun">/</span><span class="pln">php</span><span class="pun">.</span><span class="pln">ini </span></code>

Dynamic Extensions下,添加一行:

<code><span class="pln">extension </span><span class="pun">=</span><span class="pln"> openssl</span><span class="pun">.</span><span class="pln">so</span></code>

检查安装配置是否成功:

<code><span class="pun">[</span><span class="pln">shebnowei@localhost openssl</span><span class="pun">]</span><span class="pln">$ php </span><span class="pun">-</span><span class="pln">i </span><span class="pun">|</span><span class="pln"> grep openssl
openssl
</span><span class="typ">Openssl</span> <span class="kwd">default</span><span class="pln"> config </span><span class="pun">=></span> <span class="pun">/</span><span class="pln">etc</span><span class="pun">/</span><span class="pln">pki</span><span class="pun">/</span><span class="pln">tls</span><span class="pun">/</span><span class="pln">openssl</span><span class="pun">.</span><span class="pln">cnf
openssl</span><span class="pun">.</span><span class="pln">cafile </span><span class="pun">=></span> <span class="kwd">no</span><span class="pln"> value </span><span class="pun">=></span> <span class="kwd">no</span><span class="pln"> value
openssl</span><span class="pun">.</span><span class="pln">capath </span><span class="pun">=></span> <span class="kwd">no</span><span class="pln"> value </span><span class="pun">=></span> <span class="kwd">no</span><span class="pln"> value
PWD </span><span class="pun">=></span> <span class="pun">/</span><span class="pln">home</span><span class="pun">/</span><span class="pln">shebnowei</span><span class="pun">/</span><span class="pln">php</span><span class="pun">/</span><span class="pln">php</span><span class="pun">-</span><span class="lit">5.6</span><span class="pun">.</span><span class="lit">28</span><span class="pun">/</span><span class="pln">ext</span><span class="pun">/</span><span class="pln">openssl
_SERVER</span><span class="pun">[</span><span class="str">"PWD"</span><span class="pun">]</span> <span class="pun">=></span> <span class="pun">/</span><span class="pln">home</span><span class="pun">/</span><span class="pln">shebnowei</span><span class="pun">/</span><span class="pln">php</span><span class="pun">/</span><span class="pln">php</span><span class="pun">-</span><span class="lit">5.6</span><span class="pun">.</span><span class="lit">28</span><span class="pun">/</span><span class="pln">ext</span><span class="pun">/</span><span class="pln">openssl</span></code>

启动nginx或者apache,查看phpinfo():


极客公园 , 版权所有丨如未注明 , 均为原创丨本网站采用BY-NC-SA协议进行授权
转载请注明原文链接:PHP编译安装openssl拓展
喜欢 (0)