Ubuntu中的PHP openssl [英] PHP openssl in Ubuntu
问题描述
我已经创建了一个Web应用程序,该应用程序使用PHPMailer进行邮件发送,并且可以在我的本地服务器(Windows OS)上正常工作.但是,当我将其上传到生产服务器(Ubuntu 14.04.4)时,它返回错误,提示 无法发送消息.邮件错误:扩展名丢失:openssl" .我尝试寻找解决方案,但没有任何效果.无论如何,我正在使用PHP5.3.6.我希望你们能帮助我.
I have created a web app which uses PHPMailer for mailing and its working properly on my local server(Windows OS). However, when I uploaded it to the production server(Ubuntu 14.04.4) it returned an error which says "Message could not be sent.Mailer Error: Extension missing: openssl".I tried looking for solution but nothing works. Anyway I'm using PHP5.3.6. I hope you guys can help me.
推荐答案
您可以编译openssl扩展名.
第一步: 下载您正在使用的版本的php源代码.
You can compile the openssl extension.
first step : download the php source in the version you are using .
然后运行命令:
tar zxvf php-yourphpversion.tar.gz
cd php-yourphpversion/ext/openssl/
#notice if you have error "cannot find config.m4" when run phpize , you
#should rename the file "config0.m4" to "config.m4" by command
#"mv config0.m4 config.m4"
/usr/local/php/bin/phpize #here is your php location have install
#in my computer ,the php is location in
# /usr/local/php/ so the phpize is in
# /usr/local/php/bin/phpize
#(your php location)/bin/php-config
./configure --with-openssl --with-php-config=/usr/local/php/bin/php-config
make
sudo make install
然后openssl将安装并返回path
在我的电脑上,它返回/usr/local/php/lib/php/extensions/debug-zts-20160303/
then the openssl will install and return a path
in my computer it return /usr/local/php/lib/php/extensions/debug-zts-20160303/
最终修改php.ini并重新启动php-fpm :
extension_dir = "the path return after install" #you should add the return path here
extension=openssl.so
这篇关于Ubuntu中的PHP openssl的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!