Summary of permissions in PHP operations

Source: Internet
Author: User
Tags ftp client what is ftp
Many friends often encounter permission problems during PHP operations. Here, I will discuss the permission issues with you based on my previous operation experience. Permission errors usually occur when data is read and stored. First of all, let's talk about the most common limitation of system permissions on the most widely used PHP System LINUXWIN32. First, we will talk about the permission problems frequently encountered by many friends in the process of operating PHP in LINUX. I am here on permission issues based on my previous operation experience
Let's talk about it.


Permission errors usually occur when data is read and stored. Let's talk about it.


First, let's talk about the most common restrictions on system permissions.

LINUX/WIN32, the most widely used PHP System
Let's talk about common errors in LINUX.

When a user opens a website and accesses his site http: // mysite/, the user finds that the website cannot be accessed, but the prompt is that the access is forbidden.

Q: Why is my website inaccessible after it is configured?

A: First, log on to your machine (or ask your administrator to log on to the machine) and check whether your WEB Directory has read permission for group/other users.
Again, check whether your WEB server's directory settings allow browsing. Most of the problems will be solved after the corresponding data is modified.


If the above Operation steps still cannot solve your problem, please continue to look down.


If the HTML file on your website can be accessed normally, and some php files have access permissions problems, first of all, we are very happy.
Tell you that your WEB server is normal and its permissions are normal. However, you only encounter problems in your php file. For example, in your php file
The following code is used:
Include ("pathtofile/file. inc. php"); // We recommend that you do not add @ to suppress error display during debugging.
?>

$ Fp = fopen ("file. xxx", "w"); // it can be r, w, r +, a, a +...
If ($ fp ){
Fputs ($ fp, "hi, the PHP world is beautiful ");
Fclose ($ fp)
}
?>

Mkdir ("dirname ");
?>

Rename ("source", "object ");
?>
Unlink ("file ");
?> .....
Of course, you can easily understand the above code. In fact, the example I want to talk about is that you may have operations on files (directories are special files-explanations of directories in linux ).
For example, when creating, deleting, and modifying a file, the permission issue is usually caused by the file's own permissions. Here we should take a look at another knowledge,
System permission/FTP permission
What is system permission?
What is FTP permission?

Of course, here is just a description based on my personal understanding. it is not a text definition in books. you can find more definitions on the Internet, but you only need
Just understand what they mean.

System permissions (note: The system mentioned here is the operating system): It is a system that limits the permissions of system users.
FTP County: it is a permission control system for FTP users.

Okay. here, I have mentioned the above nonsense. if your FTP user is a user in your system, you only need to assign permissions to these directories through the system.
To solve the problem. If your FTP system uses your own user system, continue to look down.

As we know, the system assigns an area to the FTP service. The FTP service has certain permissions for operations in this area, and the FTP service adds its own user management.
Under the permission constraints, the FTP service performs the second permission assignment. The permission representation in LINUX is also used. Here you should have such a problem.

Q: Why is my system permission normal, but I am still accused of permission issues?

A: under the constraints of system permissions, your FTP may have its own user management system. Therefore, you should use the FTP client to log on to your FTP host and perform file permission operations.
The procedure is described on many ISP help pages.


After reading the above content, you should be able to solve 90% of the file permission problems. If you belong to that 10%, you are welcome to discuss it with me ~

In addition, for WIN32 users, if your partition is in NTFS format, refer to the above. if you are not NTFS, refer to FTP permissions.


Data storage not only directly performs file operations, but also includes databases and data streams.

Database:

Here we will use PHP with the most popular MYSQL for example. MYSQL has its own permission system, so a good DBA will always assign reasonable permissions to database users,
Database permissions are mostly concentrated in the following aspects:

1. connection to the host is rejected
2. incorrect connection account match
3. insufficient connection account permissions
4. connected the account to operate the database that does not have the permission (this problem is the same as 3 in fact, the account is insufficient throughout the county)


Data stream:

Most of the PHP Data streams are network-related functions. if these functions are incorrect, most of them are caused by the failure to obtain data due to the settings of the other server. This time
You should consider modifying the code from your program (unless you can operate on your target host)

Author: sports98
(Even if you encourage me to write these words, keep them)


I haven't written anything for a long time. are I falling behind? well, I always feel that I am falling behind when I see my PHP Extension Library. I want to write something for future reference.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.