Hướng dẫn is php installed as an apache module? - php có được cài đặt làm mô-đun apache không?

Khi PHP được sử dụng làm mô -đun Apache, nó kế thừa các quyền của người dùng Apache (thường là các quyền của người dùng "không ai"). Điều này có một số tác động đến an ninh và ủy quyền. Ví dụ: nếu bạn đang sử dụng PHP để truy cập cơ sở dữ liệu, trừ khi cơ sở dữ liệu đó có kiểm soát truy cập tích hợp, bạn sẽ phải làm cho cơ sở dữ liệu có thể truy cập được cho người dùng "không ai". Điều này có nghĩa là một tập lệnh độc hại có thể truy cập và sửa đổi cơ sở dữ liệu, ngay cả khi không có tên người dùng và mật khẩu. Hoàn toàn có khả năng một con nhện web có thể vấp ngã trên trang web của quản trị viên cơ sở dữ liệu và bỏ tất cả các cơ sở dữ liệu của bạn. Bạn có thể bảo vệ chống lại điều này với ủy quyền Apache hoặc bạn có thể thiết kế mô hình truy cập của riêng mình bằng LDAP, .htaccess Files, v.v. và bao gồm mã đó như một phần của tập lệnh PHP của bạn.

Thông thường, một khi bảo mật được thiết lập đến điểm mà người dùng PHP (trong trường hợp này, người dùng Apache) có rất ít rủi ro gắn liền với nó, người ta phát hiện ra rằng PHP hiện bị ngăn chặn việc viết bất kỳ tệp nào vào thư mục người dùng. Hoặc có lẽ nó đã được ngăn chặn truy cập hoặc thay đổi cơ sở dữ liệu. Nó đã được bảo mật như nhau để viết các tệp tốt và xấu, hoặc nhập các giao dịch cơ sở dữ liệu tốt và xấu.

Một sai lầm bảo mật thường xuyên được thực hiện tại thời điểm này là cho phép các quyền gốc Apache hoặc leo thang khả năng của Apache theo một cách khác.

Việc leo thang các quyền của người dùng Apache đối với root là cực kỳ nguy hiểm và có thể làm tổn hại toàn bộ hệ thống, vì vậy sudo'ing, chroot'ing, hoặc không nên chạy như root không nên được xem xét bởi những người không phải là chuyên gia bảo mật.

Có một số giải pháp đơn giản hơn. Bằng cách sử dụng open_basingir, bạn có thể kiểm soát và hạn chế những thư mục nào được phép sử dụng cho PHP. Bạn cũng có thể thiết lập các khu vực chỉ dành cho Apache, để hạn chế tất cả các hoạt động dựa trên web cho các tệp không phải người dùng hoặc không hệ thống.

Joe ¶

8 tháng trước

It is not useful for ordinary users to have a debate about the lack of security in using PHP without clearly listing step by step methods of resolving the issue. Such methods should be authoritatively provided by PHP and not as a user's opinion, later debated by another user.

It is not that I am opposed to debate. This is how we learn as an open-source community.  However, us mere mortals need the gods of PHP to come to conclusions and give us best practices.

bk 2 tại tôi dot com ¶

10 năm trước

doc_root already limits apache/php script folder locations.

open_basedir is better used to restrict script access to folders
which do NOT contain scripts. Can be a sub-folder of doc_root as in php doc example doc_root/tmp, but better yet in a separate folder tree, like ~user/open_basedir_root/. Harmful scripts could modify other scripts if doc_root (or include_path) and open_basedir overlap.
If apache/php can't browse scripts in open_basedir, even if malicious scripts uploaded more bad scripts there, they won't be browse-able (executable).

One should also note that the many shell execute functions are effectively a way to bypass open_basedir limits, and such functions should be disabled if security demands strict folder access control. Harmful scripts can do the unix/windows version of "delete */*/*/*" if allowed to execute native os shell commands via those functions. OS Shell commands could similarly bypass redirect restrictions and upload file restrictions by just brute force copying files into the doc_root tree. It would be nice if they could be disabled as a group or class of functions, but it is still possible to disable them one by one if needed for security.

PS. currently there is a bug whereby the documented setting of open_basedir to docroot/tmp will not work if any include or require statements are done. Right now include will fail if the included php file is not in BOTH the open_basedir tree and the doc_root+include_path trees. Which is the opposite of safe.
This means by any included php file must be in open_basedir, so is vulnerable to harmful scripts and php viruses like Injektor.

Daniel Dot Eckl tại gmx dot de ¶

20 năm trước

There is a better solution than starting every virtual host in a seperate instance, which is wasting ressources.

You can set open_basedir dynamically for every virtual host you have, so every PHP script on a virtual host is jailed to its document root.

It is not that I am opposed to debate. This is how we learn as an open-source community.  However, us mere mortals need the gods of PHP to come to conclusions and give us best practices.0

It is not that I am opposed to debate. This is how we learn as an open-source community.  However, us mere mortals need the gods of PHP to come to conclusions and give us best practices.1

It is not that I am opposed to debate. This is how we learn as an open-source community.  However, us mere mortals need the gods of PHP to come to conclusions and give us best practices.2

It is not that I am opposed to debate. This is how we learn as an open-source community.  However, us mere mortals need the gods of PHP to come to conclusions and give us best practices.3

Vikanich ¶

14 năm trước

It is not that I am opposed to debate. This is how we learn as an open-source community.  However, us mere mortals need the gods of PHP to come to conclusions and give us best practices.5

Kibab ¶

17 năm trước

It is not that I am opposed to debate. This is how we learn as an open-source community.  However, us mere mortals need the gods of PHP to come to conclusions and give us best practices.6

PHP có hoạt động với Apache không?

Cả PHP và MySQL đều tương thích với máy chủ Apache.Hai cái này là nguồn mở và dễ dàng để thiết lập.PHP chạy trên nhiều nền tảng như Windows, Linux và Unix.Do những lợi thế này, PHP được sử dụng trên các máy chủ Apache.. These two are open source and easy to set up. PHP runs on many platforms like Windows, Linux, and Unix. Because of these advantages, PHP is used on Apache servers.

Các mô -đun Apache là gì?

Các mô -đun là các chương trình dịch vụ có thể được liên kết động và tải để mở rộng bản chất của máy chủ HTTP.Theo cách này, các mô -đun Apache cung cấp một cách để mở rộng chức năng của một máy chủ web.Các chức năng thường được thêm vào bởi các mô -đun tùy chọn bao gồm: Xác thực.service programs that can be dynamically linked and loaded to extend the nature of the HTTP Server. In this way, the Apache modules provide a way to extend the function of a Web server. Functions commonly added by optional modules include: Authentication.