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.
Asked
Active
Viewed 1.4k times
-1
-
1try to install openssl extension – Mattia Dinosaur May 10 '17 at 00:35
-
that's the problem, I tried but it didn't work. can you show me the step on how to install it and include it to PHP? – Erron May 10 '17 at 00:39
-
if you install php by apt before,you can try command "sudo apt-get install php5-openssl" – Mattia Dinosaur May 10 '17 at 00:40
-
Oh, I'll try to do that. Thanks for your suggestion :D – Erron May 10 '17 at 00:41
-
@MattiaDinosaur - it says, unable to locate package :( Any other solution? – Erron May 10 '17 at 00:46
-
try `php -i | grep -i openssl` , to check whether the openssl have install before , it seems the openssl extension is installed default – Mattia Dinosaur May 10 '17 at 00:52
-
PHP 5.3 has been EOL since Aug 2014. You seriously need to upgrade for at least security's sake, if not also performance and modern language features. http://php.net/supported-versions.php – Sammitch May 10 '17 at 00:53
-
@Sammitch Even I'd loved to, I cant. The other web apps that are running in the production server is not compatible with the newer version. So this is not the right time to do that. :( – Erron May 10 '17 at 00:56
-
"You can pretend to care about your users and help them run old versions of software or you can actually care about them and give them incentive to upgrade. Do the responsible thing, run supported software and encourage your users to as well." – Sammitch May 10 '17 at 00:58
-
@MattiaDinosaur I cant use that command, because there is no CLI in my php. Anyway, I also checked the php.ini and I noticed that all of the extensions are uses '.dll' plus all of them are commented. – Erron May 10 '17 at 00:59
-
@Sammitch The thing is, the man power is not enough. I guess I have to upgrade first the existing apps in my development server before upgrading the existing version of the PHP in production server. Anyway, the critical thing to do now is to install openssl in my php :( – Erron May 10 '17 at 01:02
-
if you cannot use cli ,you should check your server configure by , the openssl seems build-in in php5.6 and php7.The most complicated method is to compile the openssl extension source . – Mattia Dinosaur May 10 '17 at 01:10
-
@MattiaDinosaur - openssl support disabled (install ext/openssl) . That's what the info says about openssl. – Erron May 10 '17 at 01:11
-
edit your php.ini and search whether have the `extension="openssl.so"` ,if don't exist , add it to php.ini and restart the php-fpm and check the again – Mattia Dinosaur May 10 '17 at 01:16
-
That's what made me so confused. The phpInfo is pointing the exact location of the php.ini, however when I opened it. It contains 'dll' extension. instead of 'so' given the fact that Im using Ubuntu. – Erron May 10 '17 at 01:20
-
check the again ,and before it you should conform that the configure of `extension_dir = "you should check location here "` is right in php.ini . Finally enter the folder of extension_dir and check the extension file is openssl.so or openssl.dll – Mattia Dinosaur May 10 '17 at 01:28
-
In my computer (Ubuntu) , the php.ini is like that `extension_dir = "/usr/local/php/lib/php/extensions/debug-zts-20160303/" ` and `extension=openssl.so `, and when i enter the folder `/usr/local/php/lib/php/extensions/debug-zts-20160303/` , the openssl file is openssl.so – Mattia Dinosaur May 10 '17 at 01:31
-
I already checked, It doesn't exist. – Erron May 10 '17 at 01:34
-
@Erron your php.ini is in windows or Ubuntu ?you should add the detail message in main body instead of comment.And the most important thing is that : you check your the window's php.ini or the ubuntu's php.ini? – Mattia Dinosaur May 10 '17 at 01:44
-
its ubuntu's php.ini. – Erron May 10 '17 at 01:47
-
Please show your code. Since Stack Overflow hides the Close reason from you: *Questions seeking debugging help ("why isn't this code working?") must include the desired behavior, a specific problem or error and the shortest code necessary to reproduce it in the question itself. Questions without a clear problem statement are not useful to other readers. See: [How to create a Minimal, Complete, and Verifiable example](https://stackoverflow.com/help/mcve).* – jww May 10 '17 at 06:00
-
@jww Im so sorry, my bad :( . But I guess I don't need to show any code since my problem is about the PHP configuration itself. – Erron May 10 '17 at 06:48
1 Answers
5
You can compile the openssl extension.
first step : download the php source in the version you are using .
then run command:
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
then the openssl will install and return a path
in my computer it return /usr/local/php/lib/php/extensions/debug-zts-20160303/
finally modify php.ini and restart php-fpm :
extension_dir = "the path return after install" #you should add the return path here
extension=openssl.so

Mattia Dinosaur
- 891
- 10
- 29