Is there any way to test PHP locally without insta

2020-02-16 12:12发布

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?

9条回答
Deceive 欺骗
2楼-- · 2020-02-16 12:23

You should try phpsh as well. It is a php interactive shell from the facebook developer folks with history, tab completion and quick access to documentation.

The project is maintained on github.

查看更多
可以哭但决不认输i
3楼-- · 2020-02-16 12:27

If you use a development environment, like Aptana Studio, you might as well click on the Run As, and run it in your preferred browser. You need WAMP/XAMPP to be installed and running in order to do so.

查看更多
放荡不羁爱自由
4楼-- · 2020-02-16 12:30

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)

Just use:

$ cd ~/public_html
$ php -S localhost:8000
查看更多
叛逆
5楼-- · 2020-02-16 12:30

Use psysh which is a wonderful tool for the purpose you described.

If your project is on Laravel, then it's "built in", as tinker, so you can invoke it as php artisan tinker.

查看更多
成全新的幸福
6楼-- · 2020-02-16 12:32

For Windows Users:

Check out the ezPHP GitHub project. Per the project description...

EzPHP is an alternative to Xamp/Wamp. EzPHP is the easiest way to setup a PHP development environment for learning PHP programming on Windows.

The scope of this project is to provide a single .exe file that will get you a PHP developing server.

Link - https://github.com/marcomilon/ezphp

Setting it up was simple. Download the exphp.exe file and drop it in a folder. When you run the exe, it will launch the server and generate a public_html folder and index.php file. Follow the instructions in the command window and navigate to http://localhost:8080. Now you can start developing in the public_html folder and refresh your browser to see your changes.

查看更多
小情绪 Triste *
7楼-- · 2020-02-16 12:35

You can install either XAMPP or WAMP server locally if you find it complicated to configure PHP for Apache.

查看更多
登录 后发表回答