gordalina / cachetool

CLI App and library to manage apc & opcache.
https://gordalina.github.io/cachetool
MIT License
1.63k stars 154 forks source link

PHP Fatal error: Unknown: Failed opening required in Unknown on line 0 #42

Closed bikong0411 closed 7 years ago

bikong0411 commented 8 years ago

hello, when i use cachetools reset opcache in php7 environoment ,sometimes i got a php-error:

[25-Oct-2016 16:20:45 Asia/Shanghai] PHP Fatal error:  Unknown: Failed opening required '/home/user/webroot/site/application/model/v2/index.php'(include_path='.:/home/user/php7/lib/php') in Unknown on line 0

i use codeigniter web framework, can you help me solve this problem?

opcache last restart time:

| Last restart time | Tue, 25 Oct 2016 16:20:45 +0000 |

opcache setting:

zend_extension="/home/user/php7/lib/php/extensions/no-debug-non-zts-20151012/opcache.so"
opcache.memory_consumption=128
opcache.interned_strings_buffer=8
opcache.max_accelerated_files=11000
opcache.revalidate_freq=0
opcache.fast_shutdown=1
opcache.enable_cli=0
opcache.save_comments=0
opcache.enable_file_override=0
opcache.huge_code_pages=0
opcache.validate_timestamps=0
opcache.log_verbosity_level=2
opcache.error_log=/home/user/php7/log/opcache.error.log
Kemallyson commented 7 years ago

The issue is because SELinux is preventing read access to the file you are trying to access,

use restorecon /home/user/webroot/site/application/model/v2/index.php to restore access to the file

Hope this helps

http://www.linuxquestions.org/questions/linux-server-73/apache-2-warning-unknown-failed-to-open-stream-permission-denied-814037/

gordalina commented 7 years ago

Use --tmp-dir to a path that SELinux does not block access to. Feel free to reopen if the issue still persists

danon commented 3 years ago

I had the same problem, I tried to run

docker run --t -v .:/project php

when I tried to do

/project:$ php file.php

I got this error.

Apparently, you can't use bound volumes from docker that easily. So I copied the volume inside the container, and used a copy.

docker run --t -v .:/project php
/project:$ cd ..
/:$ cp -r /project /project2
/:$ cd /project2
/project2: $ php file.php

and it worked.