PHP Warning: Unknown: failed to open stream

后端 未结 18 869
有刺的猬
有刺的猬 2020-12-02 10:54

I edited the apache httpd.conf file recently for the mod_rewrite to work. I don\'t know if this problem originated from that or not, but i\'m getting this problem from that

相关标签:
18条回答
  • 2020-12-02 11:36

    I got this problem when insert wrong file address into .htaccess

    php_value auto_prepend_file "/home/user/wrong/address/config.php"
    

    So if you use auto_prepend_file check your file path. It called from .htaccess so PHP can't determine error file and line.

    0 讨论(0)
  • 2020-12-02 11:38

    Here some guide how to fix it. Go to :

    cd /var/www
    
    sudo chown www-data:www-data * -R
    
    sudo usermod -a -G www-data username
    

    Change userneme with your username. I hope it help.

    0 讨论(0)
  • 2020-12-02 11:38

    I just came across of this same problem and in my case it was caused by selinux. Disabling it solved the issue. And no, I don't need selinux on my workstation, thank you.

    0 讨论(0)
  • 2020-12-02 11:41

    It is a SELinux blocking issue, Linux prevented httpd access. Here is the solution:

    # restorecon '/var/www/html/wiki/index.php'
    # restorecon -R '/var/www/html/wiki/index.php'
    # /sbin/restorecon '/var/www/html/wiki/index.php'
    
    0 讨论(0)
  • 2020-12-02 11:44

    In Fedora 25, it turned out to be an SE Linux issue, and the notification gave this solution which worked for me.

    setsebool -P httpd_read_user_content 1

    0 讨论(0)
  • 2020-12-02 11:45

    In my case the group _www that apache uses was missing in the folder's access list, so first I had to add the missing group, like so:

    sudo chown -R _www ~/path-to-folder
    

    Change _www to whatever user or group that apache is running as.

    Find out apache's user/group using apachectl -S

    The output is huge, but look at the very end something like:

    User: name="_www"
    Group: name="_www"
    
    0 讨论(0)
提交回复
热议问题