PHP Warning: Unknown: failed to open stream: Permission denied in Unknown on line 0 PHP Warning: Unknown: failed to open stream: Permission denied in Unknown on line 0 apache apache

PHP Warning: Unknown: failed to open stream: Permission denied in Unknown on line 0


The command line is wrong.

From man php or from the PHP CLI online Manual :

  • First

    --define foo[=bar]

    -d foo[=bar] Define INI entry foo with value bar

(note that there is no space before and after the = sign)

  • Second

    --docroot docroot

    -t docroot Specify the document root to be used by the built-in web server

(you need to specify the document root with the -t parameter)

So, the final command will look like this :

php -S localhost:8000 -d display_errors=1 -t public/

And it should work as expected.