virtual machine - I cannot reach php built-in server running on a VM -
i have basic php application wante run through built-in php server , lives in vm in windows machine:
<?php use \psr\http\message\serverrequestinterface request; use \psr\http\message\responseinterface response; require '../vendor/autoload.php'; $app = new \slim\app(); $app->get('/', function (request $req, response $res, $arg = []) { return 'hello world!!'; }); $app->run();
my project structure
tree -i vendor . |-- cache | `-- 6a | `-- 532bg9987gt23f4356546poo999vvb234234.php |-- composer.json |-- composer.lock |-- public | `-- js | `-- app.js |-- routes | `-- web.php `-- views `-- templates `-- index.html 7 directories, 7 files
when run curl within vm works:
php -s localhost:9899& curl localhost:9899/routes/web.php hello world!!
the problem when try connect server browser (windows machine) get
this site can’t reached
although doesn't work php built-in server, works 2 other projects developed nodejs on same vm php one.
why i'm not able reach php built-in server nodejs built-in server accessible?
you binding server localhost
. listening on localhost
network interface. won't accessible outside of machine.
tell listen on externally facing ip address instead.
alternatively, tell listen on all network interfaces:
php -s 0.0.0.0:9889
Comments
Post a Comment