You can then run a slim framework app it with PHP's built-in webserver:
$ cd [my-app-name]; php -S localhost:8080 -t public public/index.php
The problem is that you have to enter this command every day again and again. If you are running more then one app you have to use the next free port.
I want to configure my XAMPP to have 2 (or more) different localhosts and sites with 2 different root directories.
Let's name them: site1
and site2
.
- The DocumentRoot of site1 is: C:/xampp/htdocs/site1/public
- The DocumentRoot of site2 is: C:/xampp/htdocs/site2/public
I solved the problem by defining a unique port for every site.
- The url of site1 is: http://localhost:8090
- The url of site2 is: http://localhost:8091
- Open with Notepad++:
C:\xampp\apache\conf\httpd.conf
- Add this lines under Listen 80
Listen 8090
Listen 8091
-
Open with Notepad++:
C:\xampp\apache\conf\extra\httpd-vhosts.conf
-
Append this new section
<VirtualHost *:8090>
ServerAdmin webmaster@site.example.com
DocumentRoot "/xampp/htdocs/site1/public"
ServerName site1.example.com
ErrorLog "logs/site1-error.log"
CustomLog "logs/site1-access.log" common
</VirtualHost>
<VirtualHost *:8091>
ServerAdmin webmaster@site2.example.com
DocumentRoot "/xampp/htdocs/site2/public"
ServerName site2.example.com
ErrorLog "logs/site2-error.log"
CustomLog "logs/site2-access.log" common
</VirtualHost>
-
Restart Apache