PHP是否有自己的Web服务器? [英] Does PHP has its own Web Server?

查看:106
本文介绍了PHP是否有自己的Web服务器?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在我的机器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)

所以我要问系统如何在localhost上监听?

PHP是否具有自己的集成Web服务器?还是什么?

推荐答案

是的,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/zh/features.commandline.webserver.php

这篇关于PHP是否有自己的Web服务器?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆