|
In PHP using the fopen function real writing, often encounter such as:
PHP Warning: fopen (file): failed to open stream: Permission denied in (filepath) on line (num) errors, especially when based on php.conf in the virtualhost, and specify another directory will be the case may occur (I use Fedora 20), attached himself to use virtualhost configuration list:
< VirtualHost 127.0.0.1:80 >
ServerAdmin xqbumu @ jx
DocumentRoot / opt / Workspace / PHP / jx
ServerName jx
ErrorLog logs / jx-error_log
CustomLog logs / jx-access_log common
< Directory "/ opt / Workspace / PHP / jx /" >
Options Indexes MultiViews FollowSymLinks
AllowOverride All
#Order Allow, deny
#Allow From all
#Options None
Require all granted
< / Directory >
< / VirtualHost >
By configuring Selinux can solve the problem.
I used shell command as follows:
semanage fcontext -a -t httpd_sys_rw_content_t '/opt/Workspace/PHP/jx/application/controllers/temp(/.*)?'
restorecon -v '/ opt / Workspace / PHP / jx / application / controllers / temp / *'
This can be resolved in / opt / Workspace / PHP / jx / application / controllers / temp / directory literacy problem. |
|
|
|