"Unknown: Failed Opening required" error while following slimphp manual

Asked

Viewed 1,626 times

1

I’m testing the Slim Framework on a machine with Windows 10, already in the first instructions I received the error:

Fatal error: Unknown: Failed opening required 'public\public/index.php' (include_path='.;C:\php\pear') in Unknown on line 0

I searched in other related threads and saw that it might be something with permissions but I’ve already given master permission in both the PHP directory and the project directory.

Follow my settings:

  • Folder location:

    C:/php
    
  • Project site:

    D:\git\slim-saa
    
  • Version of PHP:

    PHP 7.1.12 (cli) (built: Nov 23 2017 04:21:28) ( ZTS MSVC14 (Visual C++ 2015) X6 4 ) Copyright (c) 1997-2017 The PHP Group Zend Engine v3.1.0, Copyright (c) 1998-2017 Zend Technologies

Project in Github.

I’m following exactly the Slim’s initial manual and lift the built-in server with the command:

php -S localhost:8080 -t public public/index.php

Run at root (slim-Saa folder)

Can someone give me a light on how to get around this situation?

  • It should not be allowed, this seems more like a wrong note, probably 'public/index.php', this bar is not changed ?

  • PS: I cloned your project, gave 'chmod -R 777 . ' (total permissions), ran Poser and the project opened normally and worked.

  • Hi @Anthraxisbr, yes... probably worked pq vc this in linux environment. even changing the bar continues the problem here. <code> Listening on http://localhost:8080 Document root is D: git slim-Saa public Press Ctrl-C to quit. [Fri Nov 24 10:01:56 2017] PHP Warning: Unknown: failed to open stream: No such file or directory in Unknown on line 0 [Fri Nov 24 10:01:56 2017] PHP Fatal error: Unknown: Failed Opening required’D: git slim-Saa public/index.php' (include_path='.;C: php Pear') in Unknown on line 0 </code>

  • Note that it is calling public/public. I have tested several combinations and the files are not accessible.

  • I’ve tried it all with a bash to see if it works ?

  • And the precise slimphp of 'libapache2-mod-php7.1' and 'php7.1-mcrypt' installed and active

  • that bag, I couldn’t. I’ll learn to use Docker here and try to solve it for him. Thank you very much for the help.

Show 2 more comments

1 answer

0

I managed to perform without errors by removing the public from the command:

The Slim Framework website says to run like this:

$ cd [my-app-name]; php -S localhost:8080 -t public/index.php

I succeeded in running like this:

$ cd [my-app-name]; php -S localhost:8080 -t public index.php

  • You mean like this $ cd [my-app-name]; php -S localhost:8080 -t public/index.php? For the two commanders in their answer are identical

  • I made the correction in my reply. Instead of public/index or public/index, the way it worked was public index.php

Browser other questions tagged

You are not signed in. Login or sign up in order to post.