Php include prompts failed to open stream: Permission denied in error
The following error occurs: failed to open stream: Permission denied in indicates that the apache running user has no Permission to access the specified file, so the directory file cannot be opened.
Prompt when opening the browser
Warning: include (/global. php) [function. include]: failed to open stream: Permission denied in \ index. php on line 21
Warning: include () [function. include]: Failed opening '/global. php 'for declaration (include_path = '.; c: \ php5 \ pear ') in index. php on line 21
Fatal error: Class 'fl _ global' not found in \ index. php on line 22
From so many error prompts, we can see a failed to open stream: Permission denied in, which means there is no Permission to access this problem.
Linux Solution
Linux
Chmod-R 777./dirname grant the directory write permission
Chmod 777./filename grant the file write permission.
Windows 2003 solution
I am an apache user, so I only need to grant apache user permissions (if I am an iis user, I still need to set permissions in iis)
Example: Right-click the www or web directory, and then click "security and sharing" or "attribute" in the pop-up window to enable security and other options, then add the user and set the permission to access the user, which must be selected. Note that the added user must be the same as the apache directory.