I've just installed PHP.
$ php -v
PHP 5.5.7 (cli) (built: Dec 11 2013 20:55:14)
Copyright (c) 1997-2013 The PHP Group
Zend Engine v2.5.0, Copyright (c) 1998-2013 Zend Technologies
I created a new directory called test/
with one file called test.php
containing this:
<?php echo "hello world";
When I start a php server and try to load it in the browser, I get a "Resource temporarily unavailable" error:
johnny at arch in ~/Projects/test
$ php -S localhost:8080 .
PHP 5.5.7 Development Server started at Sun Jan 5 22:34:01 2014
Listening on http://localhost:8080
Document root is /home/johnny/Projects/test
Press Ctrl-C to quit.
[Sun Jan 5 22:34:18 2014] PHP Warning: Unknown: failed to open stream: Resource temporarily unavailable in Unknown on line 0
[Sun Jan 5 22:34:18 2014] PHP Fatal error: Unknown: Failed opening required '.' (include_path='.:/usr/share/pear') in Unknown on line 0
[Sun Jan 5 22:34:19 2014] PHP Warning: Unknown: failed to open stream: No such file or directory in Unknown on line 0
[Sun Jan 5 22:34:19 2014] PHP Fatal error: Unknown: Failed opening required '.' (include_path='.:/usr/share/pear') in Unknown on line 0
I have Googled this and all issues I've found are people who are trying to include()
another file in some way (using other PHP methods). Haven't found anything similar to what I'm experiencing with just a simple echo statement.
NOTE: I've tried giving full read/write/execute permissions to both the test.php
file and the test/
directory; same results.
Ah, don't add the .
. The built-in server uses the CWD as document root (or the path specified via the -t
flag). You're attempting to use .
as a router script. Simply run...
php -S localhost:8080
See http://php.net/manual/features.commandline.webserver.php
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With