PHP 有自己的 Web 服务器吗? [英] Does PHP has its own Web Server?
问题描述
我正在我的机器 Ubuntu 16 上开发一个 Symfony 3 项目,但我还没有安装 XAMPP 或 LAMP,我启动了
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
所以对 localhost:8000 的 HTTP 请求响应正确,但我问这是否意味着 apache 自动安装在我的机器上?
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 ?
我看到很多替代方案来检查是否安装了 apache,这是系统响应:
I see many alternatives to check if apache is installed and this is the system response:
apache2 -v
The program 'apache2' is currently not installed. You can install it by typing:
sudo apt install apache2-bin
备选方案 2:
dpkg --get-selections | grep apache
libapache-pom-java install
备选方案 3:
apt-cache policy apache2
apache2:
Installed: (none)
Candidate: 2.4.18-2ubuntu3.5
Version table:
备选方案 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)
备选方案 5:
sudo service apache2 status
● apache2.service
Loaded: not-found (Reason: No such file or directory)
Active: inactive (dead)
所以我在问系统如何监听本地主机?
和PHP有自己的集成网络服务器还是什么?
推荐答案
是的,PHP 从 v5.4 开始就有一个内置的服务器.但是你应该只将它用于开发和开发.测试,未投入生产.
Yes, PHP has a built in server since v5.4. But you should only use it for development & testing, not in production.
更多信息:http://php.net/manual/en/features.commandline.webserver.php
这篇关于PHP 有自己的 Web 服务器吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!