Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

I start with PHP, wampserver and Composer on windows 10 and it will be a week that I can not fix this problem: When I type:

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

on the browser by running: "localhost:8000/test", I have this error:

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

Fatal error: Unknown: Failed opening required 'public/' (include_path = '.;C:\wamp64\bin\php7.1.9\pear') in Unknown on line 0

I installed the famous "pear", I modify the access mode to my project with:

chmod -R 777 or 755 myFramework

I even touched php.ini in apache folder and in php folder to add this line :

include_path
= '.;C:\wamp64\bin\php7.1.9\pear'

But nothing is working ! Can you help me ?

like image 547
Jean-Paul Avatar asked Oct 23 '25 22:10

Jean-Paul


1 Answers

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.

like image 102
JazZ Avatar answered Oct 25 '25 13:10

JazZ



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!