PHP server on local machine?
Install and run XAMPP: http://www.apachefriends.org/en/xampp.html
How to make php -S to work on local network?
EDIT:
You will want to launch the server with the command
php -S 0.0.0.0:8888
This will allow you to access the server remotely (see docs http://php.net/manual/en/features.commandline.webserver.php)
After this is done there are 2 ways to view the site on your local network
http://192.168.1.2:8888
where 192.168.1.2
is the IP address of your computer which you can find in your System Preferences
under Network
.
http://myMac.local:8888
where myMac
is your local computer name which you can find in your System Preferences
under Sharing
.
REMEMBER: Both of these options may require your firewall to allow incoming traffic to port 8888 (or whatever port your script is listening on), if you have that running.
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
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
Can I parse PHP locally without the use of a local host server?
You can always just save your files inside your localhost folder. Tools like xampp make running a php server effortless. Open the file in a browser, and whenever you make changes they will instantly be visible without having to copy the files around.
I cannot reach php built-in server running on a VM
You are binding your server to localhost
. It is only listening on the localhost
network interface. It won't be accessible outside of that machine.
Tell it to listen on your externally facing IP address instead.
Alternatively, tell it to listen on all network interfaces:
php -S 0.0.0.0:9889
Related Topics
How to Loop Through a MySQL Result Set More Than Once Using the MySQL_* Functions
How to Check File Types of Uploaded Files in PHP
How to Call a MySQL Stored Procedure from Within PHP Code
How to Properly Indent PHP/Html Mixed Code
PHP Session Data Not Being Saved
Does PHP Time() Return a Gmt/Utc Timestamp
MySQLi Count(*) Always Returns 1
Is There a PHP Equivalent of Perl'S Www::Mechanize
Fatal Error: Class 'PHPmailer' Not Found
Setting the PHP Default Encoding to Utf-8
How to Check If an Array Contains a Specific Value in PHP
Checking If Customer Has Already Bought Something in Woocommerce
PHP Fatal Error: Call to Undefined Function Mssql_Connect()
Why Won't My PHP App Send a 404 Error
Codeigniter Htaccess and Url Rewrite Issues