# Using SSL with the PHP builtin server

**URL:** <https://discourse.slimframework.com/t/using-ssl-with-the-php-builtin-server/1954>\
**Category:** Questions\
**Created:** [October 31, 2017, 9:24pm UTC](https://discourse.slimframework.com/t/using-ssl-with-the-php-builtin-server/1954 "2017-10-31T21:24:06Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![odan](https://avatars.discourse-cdn.com/v4/letter/o/9de053/32.png) [@odan](https://discourse.slimframework.com/u/odan)\
**Post date:** [October 31, 2017, 9:24pm UTC](https://discourse.slimframework.com/t/using-ssl-with-the-php-builtin-server/1954/1 "2017-10-31T21:24:06Z")

</div>

Hello!

I’m trying to open my slim application via HTTPS. How do you achieve this?

By default, you have to start each individual slim application manually with:

`php -S localhost: 8080 -t public public/index.php`

This command starts the PHP built-in server, but only with HTTP.  
I know that PHP built-in server does not support SSL.

I use Apache (XAMPP) in my local development environment and this solutions works quite good. The problem is, I have 10+ projects and don’t want to maintain so many HTTP+HTTPS ports.  
`https://gist.github.com/odan/4d7475f15bddec50e3092854b85a3d73#https--ssl-setup`

How do you handle many sites with the Slim framework and how to handle it with SSL?

---

<div class="post-metadata">

**Author:** ![geggleto](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.slimframework.com/geggleto/32/11_2.png) [@geggleto](https://discourse.slimframework.com/u/geggleto)\
**Post date:** [October 31, 2017, 10:00pm UTC](https://discourse.slimframework.com/t/using-ssl-with-the-php-builtin-server/1954/2 "2017-10-31T22:00:52Z")

</div>

This is a server configuration issue. Slim doesn’t care what web server you use.

You upload Slim to a web server and if you configured it to run with Ssl Great. if not… Great…

As for your local development; that’s again purely up to you. I personally do not ever use SSL locally b/c I dont feel the need to encrypt my traffic over my localhost interface.

---

<div class="post-metadata">

**Author:** ![odan](https://avatars.discourse-cdn.com/v4/letter/o/9de053/32.png) [@odan](https://discourse.slimframework.com/u/odan)\
**Post date:** [October 31, 2017, 10:47pm UTC](https://discourse.slimframework.com/t/using-ssl-with-the-php-builtin-server/1954/3 "2017-10-31T22:47:07Z")

</div>

I’m just talking about the local development environment

In this special case I have to check if there is a real SSL connection and test how the application behaves under these conditions.

But anyway, how do you switch between multiple different (Slim) projects (in your local development environment)? Do you always stop and start the PHP built-in server?

---

<div class="post-metadata">

**Author:** ![SVL](https://avatars.discourse-cdn.com/v4/letter/s/848f3c/32.png) [@SVL](https://discourse.slimframework.com/u/SVL)\
**Post date:** [November 1, 2017, 12:04am UTC](https://discourse.slimframework.com/t/using-ssl-with-the-php-builtin-server/1954/4 "2017-11-01T00:04:43Z")

</div>

For local development using XAMPP, first go to xampp\apache\conf\extra and edit the httpd-vhosts.conf file.  
Example configuration:

> \<VirtualHost \*:80\>  
> ServerName myproject.local  
> DocumentRoot “C:/xampp/htdocs/myproject”  
> \<Directory “C:/xampp/htdocs/myproject”\>  
> AllowOverride All  
> Require all granted

After editing httpd-vhosts.conf you must restart Apache.

Next you need to edit the Windows hosts file, I suggest using [HostsMan](http://www.abelhadigital.com/hostsman) (freeware) for a easy way to do so.  
You just add myproject.local and save it, you will then have access to myproject.local in your browser.

Hopefully I explained well enough to get you going.

---

<div class="post-metadata">

**Author:** ![geggleto](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.slimframework.com/geggleto/32/11_2.png) [@geggleto](https://discourse.slimframework.com/u/geggleto)\
**Post date:** [November 1, 2017, 1:40am UTC](https://discourse.slimframework.com/t/using-ssl-with-the-php-builtin-server/1954/5 "2017-11-01T01:40:02Z")

</div>

I use Vagrant with virtual box to manage a virtual host for my projects.
