How to Test PHP Locally Without Installing a Server

Is there any way to test PHP locally without installing a server?

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

How can I run a php without a web server?

You should normally be able to run a php file (after a successful installation) just by running this command:

$ /path/to/php myfile.php // unix way
C:\php\php.exe myfile.php // windows way

You can read more about running PHP in CLI mode here.


It's worth adding that PHP from version 5.4 onwards is able to run a web server on its own. You can do it by running this code in a folder which you want to serve the pages from:

$ php -S localhost:8000

You can read more about running a PHP in a Web Server mode here.

Can I run PHP without a web server

You can install XAMPP or WAMPP on Windows. If using linux based distribution check for apache or ngnix . You can put you PHP files in server root and execute on your local system.

Is it possible to run .php files on my local computer?

Sure you just need to setup a local web server. Check out XAMPP: http://www.apachefriends.org/en/xampp.html

That will get you up and running in about 10 minutes.

There is now a way to run php locally without installing a server:
https://stackoverflow.com/a/21872484/672229

PHP server on local machine?

Install and run XAMPP: http://www.apachefriends.org/en/xampp.html

How to run an php application without installing xampp on client system?

I'm a big fan of server2go. I've used it to deploy PHP applications on CD/DVD. It comes with MySQL and is relatively easy to configure. I've even replaced their splash screen with my own so no one knows I'm using it. It's donationware, but I was impressed enough to donate:

server2go-web

With this application, you don't have to install all that other stuff. It's self-contained in this executable and directory.

EDIT: To clarify, server2go does not install anything on the client machine. It runs as an exe only when you specifically want it to. When you click on the .exe file, it launches your PHP application in a browser window, then you can right-click on the server2go icon in the system tray and close it when you're done.

EDIT2: One gotcha: if you want to save data to the MySQL db on the client machine, you'll need to copy serve2go to a directory on the client machine or run it on a writable USB stick. If you run this application off CD/DVD, it will be able to read data from the database, but not write.

How to set up PHPUnit test framework without running on Dev server?

In general you want the same environments across servers, but yes, it is good enough to run the tests locally. Note that PHP 5.2.x has reached end of life. You should update to a 5.3.x version if possible.

Running php script without web Server

You can run PHP scripts without a web server. PHP doesn't have anything to do with web servers.

You need to download PHP, of course. And then you can configure Eclipse to run your scripts in the command line. See

http://www.php.net/manual/en/features.commandline.usage.php

for command line usage of PHP



Related Topics



Leave a reply



Submit