Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Laravel 5.6 in Windows 7 php 7.2.6 file_exists(): open_basedir error #24630

Closed
ghost opened this issue Jun 19, 2018 · 7 comments
Closed

Laravel 5.6 in Windows 7 php 7.2.6 file_exists(): open_basedir error #24630

ghost opened this issue Jun 19, 2018 · 7 comments

Comments

@ghost
Copy link

ghost commented Jun 19, 2018

  • OS: Windows 7
  • Laravel Version: 5.6.21
  • PHP Version: 7.2.6
  • Database Driver & Version: MySQL 5.7.17

Description:

i was using Laravel 5.5 in Windows 7 with php 7.1.1 before
but Server Requirements of Laravel 5.6 is PHP >= 7.1.3
so i fresh install php 7.2.6

follow the document : https://laravel.com/docs/5.6/authentication#introduction
i use command to install Laravel
composer create-project --prefer-dist laravel/laravel blog_a "5.5.*"
composer create-project --prefer-dist laravel/laravel blog_b

then create the database tables
php artisan migrate

on each of blog_a and blog_b use this command
php artisan make:auth

open browser visit localhost.blog_a AND localhost.blog_b
in both host register a new user then logout

if i click Login on each host:
[Laravel 5.5] blog_a (no error)

[Laravel 5.6] blog_b (show an error)
"file_exists(): open_basedir restriction in effect. File(...\blog_b\resources\lang/en/Forgot Your Password?.php)

if i disable open_basedir in php.ini OR
remove the "?" {{ __('Forgot Your Password?') }} in resources\views\auth\login.blade.php
all worked fine

so why in the same OS and same server settings, 5.5 is no error but 5.6 has error ?

i also tried use php 7.1.18 instead of php 7.2.6
[Laravel 5.5] blog_a (no error)
[Laravel 5.6] blog_b (same error file_exists(): open_basedir restriction)

may be i missing something ? thanks

@staudenmeir
Copy link
Contributor

What's the error's stacktrace?

@ghost
Copy link
Author

ghost commented Jun 19, 2018

thankyou for your reply

do you means this on the error screen left side ?

68 ErrorException
67 ErrorException
66 file_exists
65 Illuminate\Filesystem\Filesystem exists
64 Illuminate\Translation\FileLoader loadPath
63 Illuminate\Translation\FileLoader load
62 Illuminate\Translation\Translator load
61 Illuminate\Translation\Translator getLine
60 Illuminate\Translation\Translator get
59 Illuminate\Translation\Translator getFromJson
58 __
57 include
...
... and many more

@staudenmeir
Copy link
Contributor

This looks like an issue with PHP and Windows 7 (it works on Windows 10).

Windows doesn't allow filenames with question marks and apparently, just checking the file existence is enough to cause an error.

It works with Laravel 5.5 because 5.6 replaced the hardcoded English strings with translations (#23342).

In your case, the best solution is probably to replace {{ __('Forgot Your Password?') }} with a hardcoded string (in your language). If you need the translation feature, use {{ __('Forgot Your Password') }}.

@ghost
Copy link
Author

ghost commented Jun 19, 2018

i don't know if this help, i captured the error screen left side bar
laravel56_make_auth_error

work on Windows 10 ??
can you try create a new Laravel 5.6, for example
D:\www\blogx

and in the php.ini enable
open_basedir = "./;D:\www\blogx\"

restart server and create a new database for test. also edit the .env and do the steps
php artisan migrate
php artisan make:auth

browser the host of blogx , click login, Windows 10 works ??

@themsaid
Copy link
Member

When using the __() helper laravel checks if the translation line was found in a JSON file and if not it'll try to guess the filename where it can find this line which uses file_exists(), with open_basedir this prevents laravel from looking into certain directories which will prevent you from running the framework, make sure you disable that setting.

@ghost
Copy link
Author

ghost commented Jun 20, 2018

but open_basedir is security option, this is more important over all other things
unless you want an unknown package able to delete all files outside the project
eg. E:\ , F:\ or even //My_NAS

in Laravel 5.5 with enabled open_basedir is running very well

but this is no sense
and if not it'll try to guess the filename where it can find this line which uses file_exists()

actually is not the open_basedir problem, is Laraver to guess the path
and pass a wrong path fill into file_exists()

{{ __('Forgot Your Password?') }}
Forgot Your Password? is a value, must NOT a path

@driesvints
Copy link
Member

This seems more like a config issue than an actual problem with Laravel tbh. Can you first please try one of the following support channels? If you can actually identify this as a bug, feel free to report back.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants