有什么方法可以在不安装服务器的情况下在本地测试PHP? [英] Is there any way to test PHP locally without installing a server?

查看:95
本文介绍了有什么方法可以在不安装服务器的情况下在本地测试PHP?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在寻找类似 http://phpfiddle.org/之类的东西,但完全是本地的.我不想安装像Apache这样复杂的东西,然后再安装PHP,只是想在离线时尝试代码. 是否可以在本地计算机上运行PHP 5.5,而无需在其下安装整个服务器?

I'm looking for something like http://phpfiddle.org/, but completely local. I don't want to commit to installing something as complex as Apache, then PHP on top of that, just to try out code when I'm offline. Is there anything that can run PHP 5.5 on the local machine without installing an entire server underneath it?

推荐答案

如果使用PHP 5.5+,则不需要服务器-它具有内置服务器(

There's no need for a server if using PHP 5.5+ - it has a built-in server (http://www.php.net/manual/en/features.commandline.webserver.php)

只需使用:

$ cd ~/public_html
$ php -S localhost:8000

这篇关于有什么方法可以在不安装服务器的情况下在本地测试PHP?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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