2

I'm working on a Symfony 3 Project on my machine Ubuntu 16 and I haven't install XAMPP or LAMP yet and I launch

php bin/console server:start
[OK] Server listening on http://127.0.0.1:8000 

So the HTTP request to localhost:8000 is responding correctly but I'm asking if that means automatically that apache is installed in my machine ?

I see many alternatives to check if apache is installed and this is the system response:

alternative 1:

apache2 -v 
The program 'apache2' is currently not installed. You can install it by typing:
sudo apt install apache2-bin

alternative 2:

dpkg --get-selections | grep apache
libapache-pom-java              install

alternative 3:

apt-cache policy apache2
apache2:
  Installed: (none)
  Candidate: 2.4.18-2ubuntu3.5
  Version table:

alternative 4:

//check who is listening on localhost:8000
lsof -i :8000
COMMAND  PID          USER   FD   TYPE DEVICE SIZE/OFF NODE NAME
php7.0  5443 karimengineer   11u  IPv4  89313      0t0  TCP localhost:8000 (LISTEN)

alternative 5:

sudo service apache2 status
● apache2.service
   Loaded: not-found (Reason: No such file or directory)
   Active: inactive (dead)

So I'm asking how the system is listening on localhost ?

and does PHP has its own integrated web server or what ?

hakre
  • 193,403
  • 52
  • 435
  • 836
Med Karim Garali
  • 923
  • 1
  • 14
  • 37

1 Answers1

8

Yes, PHP has a built in server since v5.4. But you should only use it for development & testing, not in production.

More info: http://php.net/manual/en/features.commandline.webserver.php

Iwan Wijaya
  • 2,077
  • 1
  • 16
  • 14
  • The answer is correct. To make it more useful and complete, I'd suggest to add that the user is actually executing Symfony internal web server which is built on top of PHP internal web server (see https://symfony.com/doc/3.4/setup/built_in_web_server.html). – Francesco Abeni Apr 22 '18 at 19:50
  • This is not built-in server. This is just server implementation on PHP which is not related to working project. It doesn't load application itself upon own start. It reads it from disk and compiles it each time when request arrives. So you can change PHP code and it will be renewed on-the-fly. – Michael A. Jun 25 '18 at 21:46