Home > Article > Backend Development > php include prompt failed to open stream: Permission denied in error_PHP Tutorial
The occurrence of failed to open stream: Permission denied in means that the apache running user does not have permission to access the specified file. As a result, 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 inclusion (include_path='.;C:php5pear') in index.php on line 21
Fatal error: Class 'fl_global' not found in index.php on line 22
From so many error messages, we can see that failed to open stream: Permission denied in means that there is no permission to access this problem
Linux solution
Under linux
chmod -R 777 ./dirname gives the directory writable permissions
Chmod 777 ./filename gives the file writable permissions.
Windows 2003 solution
I am an apache user, so I only need to give the apache user permissions (if you are an iis user, you also need to set permissions in iis)
Example: Right-click the www or web directory, then click "Security and Sharing" or "Properties" in the pop-up window. You can also open it and select security, then add users and set access permissions for users. You must select as shown in the figure below. Okay, please note that the access user we add must be the same as the apache directory.