1

The question may not be clear, let me explain:

I develop websites using Symfony and there is a clever little command that allows me to start an apache server, taking the root of the server as the current directory. I can then view the result on a dedicated port (localhost:8000).

Is there an easy way to do that without Symfony, maybe included in Apache2? I would like to test something that doesn't require that PHP framework.

I know I could simply make a symlink to my actual Apache server (/var/www if I remember correctly, it has been a long time since I used that one). It's not that I'm stuck, I was just wondering if it was doable without too much tears.

2 Answers2

5

As I understand , You want to start php built-in server so you can easily do that:

 cd /path/to/your/app
 php -S localhost:8000

As output you'll get :

Listening on localhost:8000
Document root is /path/to/your/app
storm
  • 4,973
  • That is exactly what I was looking for. Thanks! – SteeveDroz Apr 24 '16 at 09:51
  • Hey, this question is a duplicate and no one proposed your solution on the original one (http://askubuntu.com/questions/520602/run-a-web-server-from-any-directory) I think you should re-post it over there! – SteeveDroz Apr 25 '16 at 05:43
  • Instead of duplicating answers, you should have flagged for these posts to be merged. – muru Apr 29 '16 at 16:34
2

i think Symfony doesn't use apache server .it uses internal php server as php after php 5.4 have internal small server for development you can start it using simple command

php [options] -S addr:port [-t docroot]

ex:

 php -S localhost:8000 -t .

to start server listening on port 8000 and doc root for it is the current dir

if you want to use apache server you can make symbolic link to you app dir in apache document root dir or setup apache virtual host

molhm
  • 101