In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-17 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/02 Report--
This article mainly explains "how to solve the problem of insufficient php fopen permissions". The explanation content in the article is simple and clear, easy to learn and understand. Please follow the ideas of Xiaobian slowly and deeply to study and learn "how to solve the problem of insufficient php fopen permissions" together!
Php fopen permissions are not enough solutions: 1, open the terminal command window;2, in the terminal execute the command "sudo chmod 666 testOpen.php" can be.
Operating environment: linux 5.9.8 system, PHP 7.1 version, DELL G3 computer
PHP uses the fopen() function to open a file.
PHP fopen() function
Function Definition and Usage: The fopen() function opens a file or URL.
Grammar:
fopen(filename,mode,include_path,context)
The last two parameters are optional, we only use the first two parameters, the code is as follows:
The function of the code is to open a file named newfile.txt under the current path by writing, and try to create it if the file does not exist. After opening the file, write the Hello World string to the file and close the file.
There is no newfile.txt file under the current folder path. At this time, the error occurs when executing the above code as follows:
Warning: fopen(newfile.txt): failed to open stream: insufficient permissions in
/home/yums/web/blog_for_r&d/scripts/testOpen.php on line 3
Unable to open file!
Not enough authority? The most common problem with Linux is that you don't have permission to create files on your hard disk. I tried giving testOpen.php higher permissions, so I executed the following command in terminal:
sudo chmod 666 testOpen.php
This PHP file has the right to create a file, I try to refresh the page, WTF, or the original problem!
Warning: fopen(newfile.txt): failed to open stream: insufficient permissions in
/home/yums/web/blog_for_r&d/scripts/testOpen.php on line 3
Unable to open file!
Forget it, I don't use this function to create files, I use gedit to create my own newfile.txt file. So I executed the following command in terminal:
gedit newfile.txt
So I created a good file, and then refresh, or permissions are not enough, I still have a look at the newfile.txt file exactly what permissions it, in the terminal execute the following command:
ls -all
Found that newfile.txt created with Notepad only has read permission, no write permission, well, the problem is here, give newfile.txt file upgrade write permission:
sudo chmod 666 newfile.txt
Now refresh the page again, no error reported, the file also wrote the corresponding string.
Thank you for reading, the above is "how to solve php fopen permissions are not enough" content, after learning this article, I believe we have a deeper understanding of how to solve php fopen permissions are not enough, the specific use of the situation also needs to be verified by practice. Here is, Xiaobian will push more articles related to knowledge points for everyone, welcome to pay attention!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.