skip to Main Content

I am using the php server from windows cmd. I generated ssl certificate and key using openssl. and started a php server by using the command provided below. but still https is not working. server is starting with the http protocol.
I want to use the https protocol with these self signed certificate in php server.

php -S localhost:8000 -t "C:/Users/Pro/Desktop/Web Development/php" -d "C:Program FilesOpenSSL-Win64binopenssl.cfg" -ssl "C:/Users/Pro/Desktop/Web Development/php/openssl/server.crt" -ssl-key "C:/Users/Pro/Desktop/Web Development/php/openssl/server.key"

this is the command.

2

Answers


  1. Chosen as BEST ANSWER

    I installed the stunnel latest version which is 5.69. Then I created the config file for stunnel and save this with stunnel.conf extension; Stunnel configuration for PHP built-in server

    cert = C:/Users/Pro/Desktop/Web Development/php/openssl/server.crt
    key = C:/Users/Pro/Desktop/Web Development/php/openssl/server.key
    debug = 7
    output = stunnel.log
    
    [php-server]
    accept = 443
    connect = localhost:8000
    
      I started the PHP server with:
    
    • php -S localhost:8000 -t "C:/Users/Pro/Desktop/Web Development/php"

    Started stunnel with:

    • stunnel "C:Program Files (x86)stunnelconfigstunnel.conf"

    now I am listening to port localhost:443 and it is redirecting to port localhost:800:

    • https://localhost:443/1.php

  2. Maybe try adding stunnel3 -d 443 -r 8000?
    For example: php -S localhost:8000 -t "C:/Users/Pro/Desktop/Web Development/php" -d "C:Program FilesOpenSSL-Win64binopenssl.cfg" -ssl "C:/Users/Pro/Desktop/Web Development/php/openssl/server.crt" -ssl-key "C:/Users/Pro/Desktop/Web Development/php/openssl/server.key" | stunnel3 -d 443 -r 8000

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search