Start the server in the current directory (php / apache)

Apparently, you can start a temporary server with Python using:

python -m SimpleHTTPServer 

Is there any way to do this for PHP and Apache? for example, one command that will serve the current folder as localhost? On Mac

+4
source share
2 answers

You can start the PHP development server in versions 5.4 and higher using

 php -S localhost:8008 

I don’t think Apache supports anything like that (being the web server itself), but for the PHP server it’s enough to test scripts, including serving static content.

+20
source

PHP 5.4 added a simple web server to PHP cli. You can run it with php -S <addr>:<port> , it will serve the current directory at <addr> via port <port>

+5
source

Source: https://habr.com/ru/post/1480244/


All Articles