Ошибка extension missing openssl

I’ve removed ; for openssl from php.ini at php as well as apache folder. I still get the error «PHPMailer Error: Extension missing: openssl» The following is the php code and I’ve setup phpmailerautoload too.

PHP CODE:

<?php
require "PHPMailerAutoload.php";
$mail = new PHPMailer();
$mail->IsSMTP();
$mail->Mailer = 'smtp';
$mail->SMTPAuth = true;
$mail->Host = 'smtp.gmail.com'; // "ssl://smtp.gmail.com" didn't worked
$mail->Port = 465;
$mail->SMTPSecure = 'ssl';
// or try these settings (worked on XAMPP and WAMP):
/*$mail->Port = 587;
$mail->SMTPSecure = 'tls';*/


$mail->Username = "vignesh*******45@gmail.com";
$mail->Password = "********";

$mail->IsHTML(true); // if you are going to send HTML formatted emails
$mail->SingleTo = true; // if you want to send a same email to multiple users. multiple emails will be sent one-by-one.

$mail->From = "vignesh*******45@gmail.com";
$mail->FromName = "Vignesh";

$mail->addAddress("vignesh*******45@gmail.com","User 1");

//$mail->addCC("user.3@ymail.com","User 3");
//$mail->addBCC("user.4@in.com","User 4");

$mail->Subject = "Testing PHPMailer with localhost";
$mail->Body = "Hi,<br /><br />This system is working perfectly.";

if(!$mail->Send())
    echo "Message was not sent <br />PHPMailer Error: " . $mail->ErrorInfo;
else
    echo "Message has been sent";
?>

Please help me in resolving the error. I’ve enabled openssl in wampserver too.

asked May 17, 2015 at 7:26

Vignesh Anandakumar's user avatar

3

PHP on IIS,

1) Open
(php install directory)php.ini

2) Uncomment (~ line 910 in php.ini)
extension=php_openssl.dll

3) Restart IIS

answered Dec 14, 2017 at 4:47

atazmin's user avatar

1

For Windows + Apache:

In PHP.INI, un-comment extension=php_openssl.dll.

In Apachebin, add libeay32.dll and ssleay32.dll. (Skipping this step causes Apache startup to twice say The ordinal 3906 could not be located in the dynamic link library LIBEAY32.dll.)

Restart Apache.

The next step is getting the SSL stuff working — TLS versus SSL, port number, authentication …

answered Dec 1, 2016 at 23:59

Bilbo's user avatar

BilboBilbo

3581 silver badge10 bronze badges

change ;extension=php_openssl.dll to extension=php_openssl.dll in your php.ini file.
then restart your webbrowser and wamp/xampp server. hope this helps.

answered Jan 17, 2017 at 18:25

Verma Aman's user avatar

In addition to what you did and what @Bilbo said, you might want to change the value form extension_dir in your php.ini to an absolute path (instead of the relative default). Not sure why, but that did the trick for me.

In your php.ini find and change extension_dir = "ext" to something like this: extension_dir = "c:/php710/ext". Your path may vary!

answered Jan 16, 2017 at 20:14

user7363501's user avatar

1) Open (php install directory) php.ini
Tip: If you can’t find your php.ini you can create a php file and run it as follows:

$inipath = php_ini_loaded_file();
 if ($inipath) {
      echo 'Loaded php.ini: ' . $inipath;
 } else {
      echo 'A php.ini file is not loaded';
 }

This will tell you where your php.ini or if you dont have one loaded.
Tip: php comes with a production and development php.ini if you need one.

2) Uncomment (~ line 910 in php.ini)
Pre 7.4.2: extension=php_openssl.dll
7.4.2: extension=openssl

3) Uncomment extension_dir = "ext" (~line 761 in php.ini)

4) Restart IIS

answered Mar 24, 2020 at 16:59

TheBoredMage's user avatar

in my case the problem was the space in the path of «ext» dir: c:/Program files/php-5.4.36/exe.

Once changed, the ext dir to a «solid» path (simply copying into a place having a path without spaces inside) and phpmail (PHPMailer->SMTPSecure("tls")) works perfectly fine!

Obviously in the php.ini file, the row extension=php_openssl.dll is to be uncommented!

Curiously, after this work through, the execution of the command line scripts only resumed after restarting the command shell (cmd).

Skully - On Strike's user avatar

answered Oct 16, 2021 at 20:01

Amadio Sacripanti's user avatar

I’ve removed ; for openssl from php.ini at php as well as apache folder. I still get the error «PHPMailer Error: Extension missing: openssl» The following is the php code and I’ve setup phpmailerautoload too.

PHP CODE:

<?php
require "PHPMailerAutoload.php";
$mail = new PHPMailer();
$mail->IsSMTP();
$mail->Mailer = 'smtp';
$mail->SMTPAuth = true;
$mail->Host = 'smtp.gmail.com'; // "ssl://smtp.gmail.com" didn't worked
$mail->Port = 465;
$mail->SMTPSecure = 'ssl';
// or try these settings (worked on XAMPP and WAMP):
/*$mail->Port = 587;
$mail->SMTPSecure = 'tls';*/


$mail->Username = "vignesh*******45@gmail.com";
$mail->Password = "********";

$mail->IsHTML(true); // if you are going to send HTML formatted emails
$mail->SingleTo = true; // if you want to send a same email to multiple users. multiple emails will be sent one-by-one.

$mail->From = "vignesh*******45@gmail.com";
$mail->FromName = "Vignesh";

$mail->addAddress("vignesh*******45@gmail.com","User 1");

//$mail->addCC("user.3@ymail.com","User 3");
//$mail->addBCC("user.4@in.com","User 4");

$mail->Subject = "Testing PHPMailer with localhost";
$mail->Body = "Hi,<br /><br />This system is working perfectly.";

if(!$mail->Send())
    echo "Message was not sent <br />PHPMailer Error: " . $mail->ErrorInfo;
else
    echo "Message has been sent";
?>

Please help me in resolving the error. I’ve enabled openssl in wampserver too.

asked May 17, 2015 at 7:26

Vignesh Anandakumar's user avatar

3

PHP on IIS,

1) Open
(php install directory)php.ini

2) Uncomment (~ line 910 in php.ini)
extension=php_openssl.dll

3) Restart IIS

answered Dec 14, 2017 at 4:47

atazmin's user avatar

1

For Windows + Apache:

In PHP.INI, un-comment extension=php_openssl.dll.

In Apachebin, add libeay32.dll and ssleay32.dll. (Skipping this step causes Apache startup to twice say The ordinal 3906 could not be located in the dynamic link library LIBEAY32.dll.)

Restart Apache.

The next step is getting the SSL stuff working — TLS versus SSL, port number, authentication …

answered Dec 1, 2016 at 23:59

Bilbo's user avatar

BilboBilbo

3581 silver badge10 bronze badges

change ;extension=php_openssl.dll to extension=php_openssl.dll in your php.ini file.
then restart your webbrowser and wamp/xampp server. hope this helps.

answered Jan 17, 2017 at 18:25

Verma Aman's user avatar

In addition to what you did and what @Bilbo said, you might want to change the value form extension_dir in your php.ini to an absolute path (instead of the relative default). Not sure why, but that did the trick for me.

In your php.ini find and change extension_dir = "ext" to something like this: extension_dir = "c:/php710/ext". Your path may vary!

answered Jan 16, 2017 at 20:14

user7363501's user avatar

1) Open (php install directory) php.ini
Tip: If you can’t find your php.ini you can create a php file and run it as follows:

$inipath = php_ini_loaded_file();
 if ($inipath) {
      echo 'Loaded php.ini: ' . $inipath;
 } else {
      echo 'A php.ini file is not loaded';
 }

This will tell you where your php.ini or if you dont have one loaded.
Tip: php comes with a production and development php.ini if you need one.

2) Uncomment (~ line 910 in php.ini)
Pre 7.4.2: extension=php_openssl.dll
7.4.2: extension=openssl

3) Uncomment extension_dir = "ext" (~line 761 in php.ini)

4) Restart IIS

answered Mar 24, 2020 at 16:59

TheBoredMage's user avatar

in my case the problem was the space in the path of «ext» dir: c:/Program files/php-5.4.36/exe.

Once changed, the ext dir to a «solid» path (simply copying into a place having a path without spaces inside) and phpmail (PHPMailer->SMTPSecure("tls")) works perfectly fine!

Obviously in the php.ini file, the row extension=php_openssl.dll is to be uncommented!

Curiously, after this work through, the execution of the command line scripts only resumed after restarting the command shell (cmd).

Skully - On Strike's user avatar

answered Oct 16, 2021 at 20:01

Amadio Sacripanti's user avatar

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and
privacy statement. We’ll occasionally send you account related emails.

Already on GitHub?
Sign in
to your account

Closed

infinitey99 opened this issue

Sep 25, 2015

· 14 comments

Comments

@infinitey99

I have enabled the extension (and restarted the service) in the php.ini file

cURL is also installed, running and working on this server. Is there something additional that needs to be configured?

php
curl

@Synchro

If openssl is installed you will see an openssl section in your phpinfo output, like this:

openssl

Check that you’ve enabled it in the appropriate SAPI — it’s common for CLI and apache/FPM versions of PHP to have separate configuration files. Beyond that, refer to the PHP docs.

PHPMailer doesn’t use curl.

@tarak1006

this is the error i have got
Mail error: Extension missing: openssl
i have tried this
modifying extension=php_openssl.dll in php.ini
but it doesnt work out

@Synchro

Fine — so make sure it’s actually working, as described above. This is a problem with your PHP config, not PHPMailer.

@Rombusevil

For everyone reaching here while googling this error:
Check your PHPMailer version requirements against your installed php version.
Recent PHPMailer versions uses ‘OPENSSL_ALGO_SHA256’ variable to check for openssl.
PHP versions prior to 5.4.8 don’t define that variable.

@Synchro

That constant is not used in the old 5.2 series — it uses OPENSSL_ALGO_SHA1, which was available from 5.0. PHPMailer 6.x and after uses OPENSSL_ALGO_SHA256, and also requires PHP 5.5 as a minimum.

@Lakshikasur

I got same error even I use PHP 7.2.

@Synchro

@Lakshikasur

@Synchro Yes, I have installed and enabled from php.ini. thanks

@Synchro

Does it actually show up in phpinfo() output like the above example?

@Lakshikasur

@Synchro Even I enabled openssl in php.ini, I was not showing as it enabled when get phpinfo();
You are correct. Thanks for your quick response.

@Cmumbi

capture1
openssl support is enabled but I’m still getting the ‘missing extension’ error. Could you kindly assist? @Synchro

@Synchro

Make sure your command-line and web environments are using the same PHP config. Run this to check your CLI environment:

You should get output like:

SSL Version => OpenSSL/1.0.2q
OpenSSL support => enabled
OpenSSL Library Version => OpenSSL 1.0.2q  20 Nov 2018
OpenSSL Header Version => OpenSSL 1.0.2q  20 Nov 2018
OpenSSL support => enabled

@Cmumbi

@Synchro my header version is different from the rest. How do I rectify that?

@Synchro

Well I have no idea how your server is configured, but if it’s something like Ubuntu, then compare the CLI and FPM configs, usually in /etc/php/7.3/fpm and /etc/php/7.3/cli.

I’ve removed ; for openssl from php.ini at php as well as apache folder. I still get the error «PHPMailer Error: Extension missing: openssl» The following is the php code and I’ve setup phpmailerautoload too.

PHP CODE:

<?php
require "PHPMailerAutoload.php";
$mail = new PHPMailer();
$mail->IsSMTP();
$mail->Mailer = 'smtp';
$mail->SMTPAuth = true;
$mail->Host = 'smtp.gmail.com'; // "ssl://smtp.gmail.com" didn't worked
$mail->Port = 465;
$mail->SMTPSecure = 'ssl';
// or try these settings (worked on XAMPP and WAMP):
/*$mail->Port = 587;
$mail->SMTPSecure = 'tls';*/


$mail->Username = "vignesh*******45@gmail.com";
$mail->Password = "********";

$mail->IsHTML(true); // if you are going to send HTML formatted emails
$mail->SingleTo = true; // if you want to send a same email to multiple users. multiple emails will be sent one-by-one.

$mail->From = "vignesh*******45@gmail.com";
$mail->FromName = "Vignesh";

$mail->addAddress("vignesh*******45@gmail.com","User 1");

//$mail->addCC("user.3@ymail.com","User 3");
//$mail->addBCC("user.4@in.com","User 4");

$mail->Subject = "Testing PHPMailer with localhost";
$mail->Body = "Hi,<br /><br />This system is working perfectly.";

if(!$mail->Send())
    echo "Message was not sent <br />PHPMailer Error: " . $mail->ErrorInfo;
else
    echo "Message has been sent";
?>

Please help me in resolving the error. I’ve enabled openssl in wampserver too.

asked May 17, 2015 at 7:26

Vignesh Anandakumar's user avatar

3

PHP on IIS,

1) Open
(php install directory)php.ini

2) Uncomment (~ line 910 in php.ini)
extension=php_openssl.dll

3) Restart IIS

answered Dec 14, 2017 at 4:47

atazmin's user avatar

1

For Windows + Apache:

In PHP.INI, un-comment extension=php_openssl.dll.

In Apachebin, add libeay32.dll and ssleay32.dll. (Skipping this step causes Apache startup to twice say The ordinal 3906 could not be located in the dynamic link library LIBEAY32.dll.)

Restart Apache.

The next step is getting the SSL stuff working — TLS versus SSL, port number, authentication …

answered Dec 1, 2016 at 23:59

Bilbo's user avatar

BilboBilbo

3281 silver badge10 bronze badges

change ;extension=php_openssl.dll to extension=php_openssl.dll in your php.ini file.
then restart your webbrowser and wamp/xampp server. hope this helps.

answered Jan 17, 2017 at 18:25

Verma Aman's user avatar

In addition to what you did and what @Bilbo said, you might want to change the value form extension_dir in your php.ini to an absolute path (instead of the relative default). Not sure why, but that did the trick for me.

In your php.ini find and change extension_dir = "ext" to something like this: extension_dir = "c:/php710/ext". Your path may vary!

answered Jan 16, 2017 at 20:14

user7363501's user avatar

1) Open (php install directory) php.ini
Tip: If you can’t find your php.ini you can create a php file and run it as follows:

$inipath = php_ini_loaded_file();
 if ($inipath) {
      echo 'Loaded php.ini: ' . $inipath;
 } else {
      echo 'A php.ini file is not loaded';
 }

This will tell you where your php.ini or if you dont have one loaded.
Tip: php comes with a production and development php.ini if you need one.

2) Uncomment (~ line 910 in php.ini)
Pre 7.4.2: extension=php_openssl.dll
7.4.2: extension=openssl

3) Uncomment extension_dir = "ext" (~line 761 in php.ini)

4) Restart IIS

answered Mar 24, 2020 at 16:59

TheBoredMage's user avatar

in my case the problem was the space in the path of «ext» dir: c:/Program files/php-5.4.36/exe.

Once changed, the ext dir to a «solid» path (simply copying into a place having a path without spaces inside) and phpmail (PHPMailer->SMTPSecure("tls")) works perfectly fine!

Obviously in the php.ini file, the row extension=php_openssl.dll is to be uncommented!

Curiously, after this work through, the execution of the command line scripts only resumed after restarting the command shell (cmd).

Skully's user avatar

Skully

2,2343 gold badges22 silver badges31 bronze badges

answered Oct 16, 2021 at 20:01

Amadio Sacripanti's user avatar

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and
privacy statement. We’ll occasionally send you account related emails.

Already on GitHub?
Sign in
to your account


Closed

infinitey99 opened this issue

Sep 25, 2015

· 14 comments

Comments

@infinitey99

I have enabled the extension (and restarted the service) in the php.ini file

cURL is also installed, running and working on this server. Is there something additional that needs to be configured?

php
curl

@Synchro

If openssl is installed you will see an openssl section in your phpinfo output, like this:

openssl

Check that you’ve enabled it in the appropriate SAPI — it’s common for CLI and apache/FPM versions of PHP to have separate configuration files. Beyond that, refer to the PHP docs.

PHPMailer doesn’t use curl.

@tarak1006

this is the error i have got
Mail error: Extension missing: openssl
i have tried this
modifying extension=php_openssl.dll in php.ini
but it doesnt work out

@Synchro

Fine — so make sure it’s actually working, as described above. This is a problem with your PHP config, not PHPMailer.

@Rombusevil

For everyone reaching here while googling this error:
Check your PHPMailer version requirements against your installed php version.
Recent PHPMailer versions uses ‘OPENSSL_ALGO_SHA256’ variable to check for openssl.
PHP versions prior to 5.4.8 don’t define that variable.

@Synchro

That constant is not used in the old 5.2 series — it uses OPENSSL_ALGO_SHA1, which was available from 5.0. PHPMailer 6.x and after uses OPENSSL_ALGO_SHA256, and also requires PHP 5.5 as a minimum.

@Lakshikasur

I got same error even I use PHP 7.2.

@Synchro

@Lakshikasur

@Synchro Yes, I have installed and enabled from php.ini. thanks

@Synchro

Does it actually show up in phpinfo() output like the above example?

@Lakshikasur

@Synchro Even I enabled openssl in php.ini, I was not showing as it enabled when get phpinfo();
You are correct. Thanks for your quick response.

@Cmumbi

capture1
openssl support is enabled but I’m still getting the ‘missing extension’ error. Could you kindly assist? @Synchro

@Synchro

Make sure your command-line and web environments are using the same PHP config. Run this to check your CLI environment:

You should get output like:

SSL Version => OpenSSL/1.0.2q
OpenSSL support => enabled
OpenSSL Library Version => OpenSSL 1.0.2q  20 Nov 2018
OpenSSL Header Version => OpenSSL 1.0.2q  20 Nov 2018
OpenSSL support => enabled

@Cmumbi

@Synchro my header version is different from the rest. How do I rectify that?

@Synchro

Well I have no idea how your server is configured, but if it’s something like Ubuntu, then compare the CLI and FPM configs, usually in /etc/php/7.3/fpm and /etc/php/7.3/cli.

While installing Composer for PHP, I get the following message:

The openssl extension is missing, which means that secure HTTPS transfers are impossible. If possible you should enable it or recompile php with —with-openssl

How to fix this problem?

asked Dec 7, 2015 at 8:39

user3660160's user avatar

4

@RiggsFolly has the right idea.

Additionally I had to:

  1. Copy php.ini-development to php.ini
  2. Uncomment the extension=php_openssl.dll line as described
  3. Uncomment this line:
    extension_dir = "ext"
  4. Make sure you find php_openssl.dll within that extension directory of course

answered Mar 11, 2016 at 5:47

runamok's user avatar

runamokrunamok

2412 silver badges6 bronze badges

2

All you need to do is activate the openssl extension in your php.ini by removing the ; comment from the line

;extension=php_openssl.dll

To

extension=php_openssl.dll

Warning, there are usually 2 php.ini files, one in the apachebin folder and one in the php folder, edit the one in the phpphp.ini folder as this is the one that controls PHP CLI.

answered Dec 7, 2015 at 12:59

RiggsFolly's user avatar

RiggsFollyRiggsFolly

7174 silver badges15 bronze badges

2

If you’ve installed directly from php.net’s executable files for windows, the installation has no active php.ini file! You can confirm this using php -ini command in your console, it says C:Windows which actually has no ini file.

You should first rename one of php.ini-development or php.ini-production to php.ini and then uncomment the extension. (i.e. removeing semicolon before the extension=php_openssl.dll in that file.)

answered Jul 23, 2017 at 15:57

Positivity's user avatar

I tried setting the environment variable, without luck.. I did however try installing the Windows Binary from https://slproweb.com/products/Win32OpenSSL.html and it started working immediately (using Xampp, if that makes a difference..)

answered Dec 20, 2019 at 2:13

thphoenix's user avatar

0

In addition to uncommenting the ;extension=php_openssl.dll line in php.ini that everyone else has mentioned, you also have to ensure the ;extension_dir = "ext" line is also uncommented. To uncomment, remove the prefixed semicolon and save.

That line might already be uncommented in packages like WAMP and XAMPP, but it’s not in a plain PHP download for Windows, so it’s worth verifying. Also, you have to create the php.ini file by copying one of the examples, like php.ini-development to a new file and then name it php.ini. Then make these changes there.

Also, in the future, to install tools such as PHP and Composer, I recommend using the Chocolatey package manager. Then it’s as simple as choco install composer. Of course, you’d still need to edit php.ini before installing Composer with the choco method. In future versions of Windows, package management tools like Chocolatey will be baked into Windows, the same way apt-get is in Ubuntu. Exciting times ahead for developers!

With either method, after installing Composer, don’t forget to restart your terminal. Whether you’re using Command Prompt, Bash (installs with Git), or Powershell, you’ll need to restart it before the updated environmental variables work.

In addition to uncommenting the ;extension=php_openssl.dll line in php.ini that everyone else has mentioned, you also have to ensure the ;extension_dir = "ext" line is also uncommented. To uncomment, remove the prefixed semicolon and save.

That line might already be uncommented in packages like WAMP and XAMPP, but it’s not in a plain PHP download for Windows, so it’s worth verifying. Also, you have to create the php.ini file by copying one of the examples, like php.ini-development to a new file and then name it php.ini. Then make these changes there.

Also, in the future, to install tools such as PHP and Composer, I recommend using the Chocolatey package manager. Then it’s as simple as choco install composer. Of course, you’d still need to edit php.ini before installing Composer with the choco method. In future versions of Windows, package management tools like Chocolatey will be baked into Windows, the same way apt-get is in Ubuntu. Exciting times ahead for developers!

With either method, after installing Composer, don’t forget to restart your terminal. Whether you’re using Command Prompt, Bash (installs with Git), or Powershell, you’ll need to restart it before the updated environmental variables work.

Recently, when writing a web page, you need to use phpmailer to send e-mail. Write an example according to the demo given on the official website, but the error extension missing: OpenSSL is reported

Finally, it is found that the configuration in php.ini needs to be modified:

Put one of them

      extension=php_openssl.dll

open it

The demo code is added as follows:

 1 <?php
 2 require 'PHPMailerAutoload.php';
 3 
 4 $mail = new PHPMailer;
 5 
 6 //$mail->SMTPDebug = 3;                               // Enable verbose debug output
 7 
 8 $mail->isSMTP();                                      // Set mailer to use SMTP
 9 $mail->Host = 'smtp1.example.com;smtp2.example.com';  // Specify main and backup SMTP servers
10 $mail->SMTPAuth = true;                               // Enable SMTP authentication
11 $mail->Username = '[email protected]';                 // SMTP username
12 $mail->Password = 'secret';                           // SMTP password
13 $mail->SMTPSecure = 'tls';                            // Enable TLS encryption, `ssl` also accepted
14 $mail->Port = 587;                                    // TCP port to connect to
15 
16 $mail->setFrom('[email protected]', 'Mailer');
17 $mail->addAddress('[email protected]', 'Joe User');     // Add a recipient
18 $mail->addAddress('[email protected]');               // Name is optional
19 $mail->addReplyTo('[email protected]', 'Information');
20 $mail->addCC('[email protected]');
21 $mail->addBCC('[email protected]');
22 
23 $mail->addAttachment('/var/tmp/file.tar.gz');         // Add attachments
24 $mail->addAttachment('/tmp/image.jpg', 'new.jpg');    // Optional name
25 $mail->isHTML(true);                                  // Set email format to HTML
26 
27 $mail->Subject = 'Here is the subject';
28 $mail->Body    = 'This is the HTML message body <b>in bold!</b>';
29 $mail->AltBody = 'This is the body in plain text for non-HTML mail clients';
30 
31 if(!$mail->send()) {
32     echo 'Message could not be sent.';
33     echo 'Mailer Error: ' . $mail->ErrorInfo;
34 } else {
35     echo 'Message has been sent';
36 }

Similar Posts:

Kodlogs

Problem :
I am trying to install Composer but I am getting the following error:

«Some settings on your machine make Composer unable to work properly. Make sure that you fix the issues listed below and run this script again:

The OpenSSL extension is missing, which means that secure HTTPS transfers are impossible. If possible you should enable it or recompile php with —with-openssl»

I have also gone into my php.ini-production and uncommented the following code: «extension=php_openssl.dll»

But still, it is not working for me, Am I missing something?

Solution :
I had also faced the same issue in the past, please follow the below approach to resolve your issue:

I doubt the «php.ini-production» is the dummy configuration file suitable for live environments. I will suggest you do a php -i at the console and also try to find the ‘php.ini’ path, to understand where it is expecting the ini file to be kept. It may be the case that normally it is expecting «php.ini», and it may not actually exist. If that is the case then, copy the php.ini-development (or equivalent) to the location required.

This is very near the top of actually a very long output, so you may find it redirecting it to a file helpful (php -i > C:phpinfo.txt).

Another Solution :
I conceived «php.ini-production» is a dummy configuration file suitable for live environments. Do a php -i at the console and trace the ‘php.ini’ path, to view where it is expecting the ini file to be kept. This is generally expecting «php.ini», and may not really exist — in case it does not, copy php.ini-development (or same) to the location requisite.

This is near the top of (a very long) output, hence you may trace redirecting it to a file useful

php -i > C:phpinfo.txt).
You will further require to uncomment the extension dir. For example, trace this line in your php.ini file:

;extension_dir = «ext»
Remove the semi-colon in front and save the file. I am certain this will perform.

Remember to open your php.ini Administrator mode

After altering anything in php.ini you have to restart your server, ensure that you did so first of all.

in WAMPserver edit this files:

D:wampbinphpphp5.3.10php.ini

or

D:wampbinphpphp5.4.12php.ini (based on version)

Do not employ the php.ini in the WAMP server menu. It will not perform. Go to the origin of your wamp and as defined above with D as root.

Create a php.ini (for example from php.ini-production), open it in an editor as admin (!), remove the commenting semicolon; in front of extension=php_openssl.dll, set the extension_dir accurately, and save the file. After that, it must be performed. However once again: open and edit the php.ini as admin.

In case you are employing MAMP on Windows, you require to alter the extension for php.ini-development to php.ini . After that, paste this line ;extension_dir = «ext» into the php.ini file, prior to the first extension appearing and uncommenting this other line ;extension=php_openssl.dll removing the prefixed semicolon. Remember to restart apache

A similar error happened to me. I solved it by turning off TLS for Composer, it’s not safe however I considered the risk on my development machine.

Attempt this:

composer config -g — disable-tls true
and re-run your Composer. It performs to me.

However, it’s not secure and not recommended for your Server. The official website says:

In the case set to true, all HTTPS URLs will be attempted with HTTP instead and no network-level encryption is worked. Enabling this is a security risk and is NOT recommended. The better method is to enable the php_openssl extension in php.ini.

In case you don’t want to enable unsecure layer in your machine/server, so setup your php to enable OpenSSL and it also performed. Ensure that the PHP Openssl extension has been installed and enable it on php.ini file.

To enable OpenSSL, add or trace and uncomment this line on your php.ini file:

Linux/OSx:

extension=php_openssl.so
Windows:

extension=php_openssl.dll
And reload your php-fpm / web-server in case reqired

For the composer reference, there are two relevant options: disable-tls and secure-http.

nano ~/.composer/config.json …
{
«config»: {
«disable-tls»: true,
«secure-http»: false
}
}
Thereafter it complains much:

You are running Composer with SSL/TLS protection disabled.
Warning: Accessing getcomposer.org over http which is an insecure protocol.
However, it works the composer selfupdate (or whatever).

while one cannot easily «enable SSL in the php.ini» on Linux; PHP requires to be compiled with openSSL configured as shared library — in order to be able to access it from the PHP CLI SAPI.

Hence, after inventioning and looking for a while I found that my PHP.INI obviously didn’t look in the accurate directory for my PHP Extensions, so I went under:

«Directory in which the loadable extensions (modules) reside.» And casting the following:

; http://php.net/extension-dir
; extension_dir = «./»
; On windows:
;extension_dir = «ext»
And easily removed the ; infront of «extension_dir = «ext», note this is just for Windows, remove the semicolon in front of the first extension_dir in case you are running a different operating system.

Message could not be sent.Mailer Error: Extension missing: openssl

1);extension=php_openssl.dll been changed to extension=php_openssl.dll in php.in in both apache and php.

2);extension_dir = «ext» has been changed from extension_dir = «ext»

3)i have restart the wamp server

4)i am using PHP 5.6.25 and added composer to same versionPHP 5.6.25

5) i have C:wampbinphpphp5.6.25extrassslopenssl.cnf i checked for the variable OPENSSL_CONFi dint have any variable i dont know  What to add System variable: OPENSSL_CONF

SOURCE:How to enable PHP’s openssl extension to install Composer?

<?php
 if (isset($_POST))
 {
  require_once(‘class.phpmailer.php’);

  require_once(‘class.smtp.php’);

  require ‘PHPMailer/PHPMailerAutoload.php’;

  $mail = new PHPMailer();

  $mail->SMTPDebug = 0;                               // Enable verbose deb

  $mail->isSMTP();                                      // Set mailer to use SMTP
  $mail->Host = ‘smtp.gmail.com’;  // Specify main and backup SMTP servers
  $mail->SMTPAuth = true;                               // Enable SMTP authentication
  $mail->Username = ‘eiman.sadath.assadi@gmail.com’;                 // SMTP username
  $mail->Password = ‘siliconia’;                           // SMTP password
  $mail->SMTPSecure = ‘tls’;                            // Enable TLS ‘tls’encryption, `ssl` also accepted
  $mail->Port = 587;                                    // TCP port to connect to or 587 o

  $mail->setFrom(‘myaccount@gmail.com’);
  $mail->addAddress(‘myaccount1@gmail.com’, ‘user1’);     // Add a recipient
  $mail->addAddress(‘eiman.suhan@gmail.com’);               // Name is optional
   //$mail->addReplyTo(‘info@example.com’, ‘Information’);
  //$mail->addCC(‘cc@example.com’);
 //$mail->addBCC(‘bcc@example.com’);

  //mail->addAttachment(‘/var/tmp/file.tar.gz’);         // Add attachments
  //$mail->addAttachment(‘/tmp/image.jpg’, ‘new.jpg’);    // Optional name
  $mail->isHTML(true);                                  // Set email format to HTML

  $mail->Subject = ‘Registration Form’;
  $mail->Body    = ‘This body <b>in bold!</b>’;
  $mail->AltBody = ‘This is the body in plain text for non-HTML mail clients’;

 if(!$mail->send()) {
 echo ‘Message could not be sent.’;
 echo ‘Mailer Error: ‘ . $mail->ErrorInfo;
  } else {
 echo ‘Message has been sent’;
 }
 }
 ?>

Ну поискал я схожую тему на форуме, но она мои запросы не удовлетворила к сожалению, там как я идумал указали на 2 скрипта:
HTML-форма index.php

Кликните здесь для просмотра всего текста

HTML5
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
<HTML> 
 
<HEAD> 
 
<TITLE>Отправка сообщения с вложением</TITLE> 
 
</HEAD> 
 
<BODY> 
 
<H3> <center><font color=#1E90FF>Отправка сообщения с вложением</font></H3> 
 
<center> 
 
<table width=1 border=0> 
 
<form action=simple_mail.php enctype='multipart/form-data' method=post> 
 
 
 
<tr><td width=50%>To:</td><td align=right><input type=text name=mail_to maxlength=32></td></tr> 
 
<tr><td width=50%>Subject:</td><td align=right><input type=text name=mail_subject maxlength=64></td></tr> 
 
<tr><td colspan=2>Сообщение:<br><textarea cols=50 rows=8 name=mail_msg></textarea></td> 
 
<tr><td width=50%>Photo:</td><td align=right><input type=file name=mail_file maxlength=64></td></tr> 
 
</tr><tr><td colspan=2><input type=submit value='Отправить'></td></tr> 
 
</form> 
 
</table> 
 
</center> 
 
</BODY> 
 
</HTML>

«Обработчик simple_mail.php HTML-формы index.php может выглядеть следующим образом «

Кликните здесь для просмотра всего текста

PHP
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
<?php 
 
  if(empty($_POST['mail_to'])) exit("Введите адрес получателя"); 
 
  // проверяем правильности заполнения с помощью регулярного выражения 
 
  if (!preg_match("/^[0-9a-z_]+@[0-9a-z_^.]+.[a-z]{2,3}$/i", $_POST['mail_to'])) 
     exit("Введите адрес в виде somebody@server.com"); 
 
  $_POST['mail_to'] = htmlspecialchars(stripslashes($_POST['mail_to'])); 
 
  $_POST['mail_subject'] = htmlspecialchars(stripslashes($_POST['mail_subject'])); 
 
  $_POST['mail_msg'] = htmlspecialchars(stripslashes($_POST['mail_msg'])); 
 
  $picture = ""; 
 
  // Если поле выбора вложения не пустое - закачиваем его на сервер 
 
  if (!empty($_FILES['mail_file']['tmp_name'])) 
 
  { 
 
    // Закачиваем файл 
 
    $path = $_FILES['mail_file']['name']; 
 
    if (copy($_FILES['mail_file']['tmp_name'], $path)) $picture = $path; 
 
  } 
 
  $thm = $_POST['mail_subject'];
 
  $msg = $_POST['mail_msg'];
 
  $mail_to = $_POST['mail_to'];
 
  // Отправляем почтовое сообщение 
 
  if(empty($picture)) mail($mail_to, $thm, $msg); 
 
  else send_mail($mail_to, $thm, $msg, $picture); 
 
  // Вспомогательная функция для отправки почтового сообщения с вложением 
 
  function send_mail($to, $thm, $html, $path) 
 
  { 
 
    $fp = fopen($path,"r"); 
 
    if (!$fp) 
 
    { 
 
      print "Файл $path не может быть прочитан"; 
 
      exit(); 
 
    } 
 
    $file = fread($fp, filesize($path)); 
 
    fclose($fp); 
 
    
 
    $boundary = "--".md5(uniqid(time())); // генерируем разделитель 
 
    $headers .= "MIME-Version: 1.0n"; 
 
    $headers .="Content-Type: multipart/mixed; boundary="$boundary"n"; 
 
    $multipart .= "--$boundaryn"; 
 
    $kod = 'koi8-r'; // или $kod = 'windows-1251'; 
 
    $multipart .= "Content-Type: text/html; charset=$kodn"; 
 
    $multipart .= "Content-Transfer-Encoding: Quot-Printednn"; 
 
    $multipart .= "$htmlnn"; 
 
 
 
    $message_part = "--$boundaryn"; 
 
    $message_part .= "Content-Type: application/octet-streamn"; 
 
    $message_part .= "Content-Transfer-Encoding: base64n"; 
 
    $message_part .= "Content-Disposition: attachment; filename = "".$path.""nn"; 
 
    $message_part .= chunk_split(base64_encode($file))."n"; 
 
    $multipart .= $message_part."--$boundary--n"; 
 
 
 
    if(!mail($to, $thm, $multipart, $headers)) 
 
    { 
 
      echo "К сожалению, письмо не отправлено"; 
 
      exit(); 
 
    } 
 
  } 
 
?>

Т.е. форма и обработчик есть, но как все это состыковать с аккаунтом я незнаю.
Добавлено через 5 минут

Зачем тогда делать это самостоятельно?

А как иначе?

Обычная форма + PHPMailer (или аналоги).

Ну вот видите, а минуту назад я и понятия не имел о классе PHPMailer и планировал это осуществить через какой-то почтовый клиент.
Спасибо за подсказку =)

Добавлено через 23 часа 16 минут
Посмотрел я видеоурок по PHPMailer, установил денвер, скачал PHPMailer и положил как показано в туториале
Скопипастил во такой код:

PHP
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
<?php 
require 'phpmailerPHPMailerAutoload.php';
$mail = new PHPMailer;
$mail->isSMTP();
$mail->Host = 'smtp.gmail.com';
$mail->SMTPAuth = true;
$mail->Username = 'здесь логин';
$mail->Password = 'здесь пароль';
$mail->SMTPSecure = 'ssl';
$mail->Port = '465';
$mail->CharSet = 'UTF-8';
$mail->From = ('логин@gmail.com');
$mail->FromName = ('Vasya');
$mail->addAddress('логин@gmail.com');
$mail->Subject = 'PHPMailer sendmail test';
$mail->Body = 'This is a plain-text message body';
 
if ( $mail->send()) {
    echo 'Письмо отправлено';
} else {
    echo 'Письмо не отправлено';
    echo 'Ошибка: ' . $mail->ErrorInfo;
 
}
 
?>

Но при загрузке страницы, он мне, к сожалению, вибивает такую ошибку:

Код

"Письмо не отправленоОшибка: Extension missing: openssl"

Погуглил… Писали что проблема может быть в закоментированой строчке в файле php.ini

Код

;extension=php_openssl.dll

Расскоментировал, передернул денвер(выключил-включил), не помогло =(

Может быть у вас будут какие-то предположения по поводу ошибки:

Код

 Extension missing: openssl

While installing Composer for PHP, I get the following message:

The openssl extension is missing, which means that secure HTTPS transfers are impossible. If possible you should enable it or recompile php with —with-openssl

How to fix this problem?

asked Dec 7, 2015 at 8:39

user3660160's user avatar

4

@RiggsFolly has the right idea.

Additionally I had to:

  1. Copy php.ini-development to php.ini
  2. Uncomment the extension=php_openssl.dll line as described
  3. Uncomment this line:
    extension_dir = "ext"
  4. Make sure you find php_openssl.dll within that extension directory of course

answered Mar 11, 2016 at 5:47

runamok's user avatar

runamokrunamok

2512 silver badges6 bronze badges

2

All you need to do is activate the openssl extension in your php.ini by removing the ; comment from the line

;extension=php_openssl.dll

To

extension=php_openssl.dll

Warning, there are usually 2 php.ini files, one in the apachebin folder and one in the php folder, edit the one in the phpphp.ini folder as this is the one that controls PHP CLI.

answered Dec 7, 2015 at 12:59

RiggsFolly's user avatar

RiggsFollyRiggsFolly

7194 silver badges15 bronze badges

2

If you’ve installed directly from php.net’s executable files for windows, the installation has no active php.ini file! You can confirm this using php -ini command in your console, it says C:Windows which actually has no ini file.

You should first rename one of php.ini-development or php.ini-production to php.ini and then uncomment the extension. (i.e. removeing semicolon before the extension=php_openssl.dll in that file.)

answered Jul 23, 2017 at 15:57

Positivity's user avatar

I tried setting the environment variable, without luck.. I did however try installing the Windows Binary from https://slproweb.com/products/Win32OpenSSL.html and it started working immediately (using Xampp, if that makes a difference..)

answered Dec 20, 2019 at 2:13

thphoenix's user avatar

0

  • Ошибка explorer exe при загрузке windows
  • Ошибка explorer exe класс не зарегистрирован windows 10
  • Ошибка explorer exe windows 7 при включении компьютера
  • Ошибка explorer exe win xp
  • Ошибка explorer exe r6025