1. 程式人生 > >centos7安裝php的openssl擴充套件

centos7安裝php的openssl擴充套件

錯誤提示:

SMTP connect() failed

呼叫phpmailer傳送郵件提示這個錯誤

解決辦法:

1.缺少openssl擴充套件,安裝過程

1、cd /root/tar  
wget http://www.openssl.org/source/openssl-1.0.2j.tar.gz
tar -zxvf openssl-1.0.2j.tar.gz  
cd php-5.6.16/ext/openssl/
mv config0.m4 config.m4
/usr/local/php/bin/phpize  
./configure --with-openssl --with-php-config=/usr/local/php/bin/php-config  
make  
sudo make install

2、安裝完成,會顯示安裝目錄,cd安裝目錄,可以看到openssl.so擴充套件

3、修改php.ini,如果找不到配置檔案,可以輸出phpinfo檢視,開啟openssl擴充套件:

增加extension = openssl.so

3、重啟nginx 或者apache,reload不行,一定要重啟

/etc/init.d/nginx restart 

如果是apache,使用service httpd restart

4、重啟php

/etc/init.d/php-fpm stop 

/etc/init.d/php-fpm start