개발! 딱 깔끔하고 센스있게!

PHP 스크립트 / 디렉토리에 어떤 권한이 있습니까? 본문

개발 스크랩 메모/PHP

PHP 스크립트 / 디렉토리에 어떤 권한이 있습니까?

렉사이 2020. 12. 14. 22:36

나는 한 친구가 한 사이트를 한 인터넷 호텔에서 다른 집으로 옮기는 것을 돕고 있다.

오래된 곳은 이미 문을 닫았으니, 나는 단지 평면의 tar 서류밖에 없다.

이 사이트는 HTML 문서를 포함하여 소량의 자바 응용 프로그램을 다운로드할 수 있습니다.

자바 프로그램을 URL = < 호스트 > / PHP / RealSt.php이 php 스크립트는 다른 php 스크립트를 포함합니다.

/ / inc / db u login.php $link = my sql u connnect () 에 연결되어 있습니다.

다른 파일 register.php sql 삽입하여 새 발송된 데이터베이스에 저장합니다.

나의 문제는 basiccaly입니다.

이 두 php 파일을 새 사이트의 어디에 두어야 합니다.

디렉터리와 파일은 어떤 권한이 있습니까?

오래된 웹 서버는 분명히 / php / inc 디렉토리가 있다.

이것들은 새 웹 서버에 존재하지 않습니다.

제가 만들어야 하나요?그들은 어떤 허가를 받아야 합니까?나는 비밀번호를 단독 php 파일에 두고 싶은 이유는 안전성이다.

/ php / inc 디렉토리는 다른 권한을 가지고 있을 수 있습니다.

새 서버는 디렉토리를 가지고 있습니다:

  • /httpdos
  • /httpsdos
  • /cgi-bin
  • /conf (and some others probably irrelevant)

나의 문제

  1. Does the file-extension (.php) mean something to the server: as PHP scripts are "included" in HTML code (between , does the server need to look at the file suffix or is it irrelevant? (I understand that the server reacts on the , of course)

  2. should the public file (register.php in my case) be placed in the httpdocs/ directory or does the server (apache I think) reacts on something and fetches it in another directory?

  3. Should the PHP script have permission R-X (read and execute), --X (execute) or R-- (read)? From a OS perspective I guess apache is just reading this files, meaning that they should be R--, but this would mean that if PHP service is "stopped" the client would get all the PHP code in his browser(?). I would prefer it being --X but as this is neither a binary nor has a #!, I guess it must be --R?

  4. If the public PHP script can be placed in another dir (e.g /php instead of /httpdocs) what should /php (and the script) have for permission?. I guess the server has to know about this /php directory (or are there usual defaults?)

  5. The PHP script included (../inc/db_login.php, containing SQL password) should not be under /httpdocs I guess. This means that my register.php is including a file which is not under the /httpdocs subtree. Does this work? Does the server need to know?

서버 설정을 알아야 한다는 것을 알고 있습니다.

만약 당신의 답안이 기본이라고 가정한다면, 당신은 그것이 어디에 변화되었는지 알 수 있습니다.

대답

디렉터리는 반드시 실행 권한이 있어야 사용할 수 있다.

보통 0755입니다.

mod u php 스크립트를 통해 실행하지 않는 것이 아니라 읽는 길이다.

064444는 충분하다.

기록해야 할 디렉터리는 웹 서버를 실행하는 사용자가 가져야 합니다.

권한에 대한 다른 문제가 있을 수 있습니다.

예를 들어 세리뉴스와 같은 내용은 기본지식을 이해할 수 있습니다.

다른 사용자나 외부 클라이언트에서 방문할 수 없는 문서는 0600으로 웹 서버 사용자가 보유하고, documentroot 에 위치합니다.

안전 모드 u phphp 스크립트가 도cumentroot 이외의 내용이 포함되지 않도록 주의하십시오. 안타까운 결함입니다.

Comments