Enabling the Openssl in Xampp

How to enable openssl support in XAMPP?

To get openssl, curl and intl enabled on your xampp server follow the following steps below:

NB: the above steps are ok but you wont get nowhere if you are a newbie in code editing

  1. open the location where your xampp server is installed e.g C:\xampp or C:\program files\xampp depending on where yours is installed

  2. search for the search bar in the folder where your xampp server is installed

  3. type C:\xampp\php\php.ini or C:\program files\xampp\php\php.ini , then open the php.ini file using either notepad or wordpad

  4. then scroll until you see ;extension=openssl.dll, ;extension=curl.dll, ;extension=intl.dll, then remove the comment (;) and save your file

  5. shutdown your server by quitting and restart it

Handling The openssl extension is missing: in XAMPP

Here, as php --ini command, points to the C:\windows path, you should change the file in that path (But consider making a copy of original file in the case of making a mistake). After all you could put a copy of php.ini in the desired location and force the php to use it:

php -c /path/to/my/custom/php.ini

How to use or enable openssl in xampp

Design your forms to use action="https://...." to encrypt the transmission. Setup a server certificate and enable mod_ssl in the Apache config.

The PHP openssl functions do not enter the picture for that. You will only need the openssl commandline tool once for generating a self signed certificate, if you didn't aquire a commercial one.

How to Create Valid SSL in localhost for XAMPP

In my XAMPP install I basically have a clone to all the site that I managed. And All of them (of course) use SSL/HTTPS.

Sample Image

Here’s the step by step guide:

In this step we are going to crate SSL and setup “site.test” website.

Sample Image

1. Navigate to Apache directory in XAMPP.

In regular install it’s in C:\xampp\apache.

Sample Image

2. Create a folder in that page.

This is where we will store our cert. In this example I will create “crt” folder. So we will have C:\xampp\apache\crt

Sample Image

3. Add this files.

  • cert.conf

  • make-cert.bat

Sample Image

4. Edit cert.conf and Run make-cert.bat

Change {{DOMAIN}} text using the domain we want to use, in this case site.test and save.

Double click the make-cert.bat and input the domain site.test when prompted. And just do enter in other question since we already set the default from cert.conf.

Sample Image

Note: I don’t know how to do text replace in .bat script, if you do, let me know in the comment how to do it and I will update make-cert.bat to automatically replace the {{DOMAIN}} with the domain input.

Sample Image

5. Install the cert in windows.

After that, you will see site.test folder created. In that folder we will have server.crt and server.key. This is our SSL certificate.

Double click on the server.crt to install it on Windows so Windows can trust it.

Sample Image

And then select Local Machine as Store Location.

Sample Image

And then Select “Place all certificate in the following store” and click browse and select Trusted Root Certification Authorities.

Sample Image

Click Next and Finish.

And now this cert is installed and trusted in Windows. Next is how how to use this cert in XAMPP.

Sample Image

6. Add the site in Windows hosts

  • Open notepad as administrator.
  • Edit C:\Windows\System32\drivers\etc\hosts (the file have no ext)
  • Add this in a new line:
127.0.0.1 site.test

This will tell windows to load XAMPP when we visit http://site.test You can try and it will show XAMPP dashboard page.

Sample Image

7. Add the site in XAMPP conf.

We need to enable SSL for this domain and let XAMPP know where we store the SSL Cert. So we need to edit C:\xampp\apache\conf\extra\httpd-xampp.conf

And add this code at the bottom:

 ## site.test
<VirtualHost *:80>
DocumentRoot "C:/xampp/htdocs"
ServerName site.test
ServerAlias *.site.test
</VirtualHost>
<VirtualHost *:443>
DocumentRoot "C:/xampp/htdocs"
ServerName site.test
ServerAlias *.site.test
SSLEngine on
SSLCertificateFile "crt/site.test/server.crt"
SSLCertificateKeyFile "crt/site.test/server.key"
</VirtualHost>

After that, you will need to restart Apache in XAMPP. It’s very simple, simply open XAMPP Control Panel and Stop and re-Start Apache Module.

Tips: In XAMPP conf, as you can see you can change the domain root directory if needed. Eg. as sub-dir in htdocs.

Sample Image

8. Restart your browser and Done!

This is required to load the certificate. And visit the domain on your browser, and you will see green lock!

Sample Image

Sample Image

I hope this tutorial is useful!

Source: https://shellcreeper.com/how-to-create-valid-ssl-in-localhost-for-xampp/

Setting up SSL on a local xampp/apache server

Apache part - enabling you to open https://localhost/xyz

There is the config file xampp/apache/conf/extra/httpd-ssl.conf which contains all the ssl specific configuration. It's fairly well documented, so have a read of the comments and take look at http://httpd.apache.org/docs/2.2/ssl/.
The files starts with <IfModule ssl_module>, so it only has an effect if the apache has been started with its mod_ssl module.

Open the file xampp/apache/conf/httpd.conf in an editor and search for the line

#LoadModule ssl_module modules/mod_ssl.so

remove the hashmark, save the file and re-start the apache. The webserver should now start with xampp's basic/default ssl confguration; good enough for testing but you might want to read up a bit more about mod_ssl in the apache documentation.


PHP part - enabling adldap to use ldap over ssl

adldap needs php's openssl extension to use "ldap over ssl" connections. The openssl extension ships as a dll with xampp. You must "tell" php to load this dll, e.g. by having an extension=nameofmodule.dll in your php.ini

Run

echo 'ini: ', get_cfg_var('cfg_file_path');

It should show you which ini file your php installation uses (may differ between the php-apache-module and the php-cli version).

Open this file in an editor and search for

;extension=php_openssl.dll

remove the semicolon, save the file and re-start the apache.

see also: http://docs.php.net/install.windows.extensions



Related Topics



Leave a reply



Submit