유닉스 시스템에 설치

Table of Contents

이 섹션은 유닉스 시스템에 대한 PHP의 일반적인 설정과 설치에 대해서 안내합니다. 진행하기 전에 플래폼 및 웹서버의 사양을 확인하십시오.

일반적인 설치 고려 장에서 나온 매뉴얼 아웃라인에 따라, 이 장에서는 주로 PHP를 웹 중심으로 설정을 합니다. 물론, 명령줄 사용을 위한 PHP 설정도 포함하고 있습니다.

유닉스 플래폼에 PHP를 설치하는 방법은 여러가지가 있습니다. configure 및 컴파일 프로세스를 거치거나, 미리 작성된 패키지 방법 등이 있습니다. 이 문서는 주로 configure와 컴파일을 통한 작업에 맞추어져 있습니다. 많은 유닉스 호환 시스템은 몇몇 패키지 설치 시스템을 갖추고 있습니다. 이는 일반적인 설정에는 도움을 줄 수 있지만, 다른 기능을 필요로 할 경우에는 (보안 서버나, 다른 데이터베이스 드라이버 등), PHP와 웹 서버를 빌드할 필요가 있습니다. 소프트웨어의 컴파일과 빌드에 익숙하지 않다면, 필요한 기능이 들어있는 PHP 패키지를 찾아보는 것도 좋을 것입니다.

컴파일을 위해 필요한 지식과 소프트웨어:

  • 기본적인 유닉스 기술 (C 컴파일러와 "make"를 실행할 수 있어야 함)
  • ANSI C 컴파일러
  • flex: 버전 2.5.4
  • bison: 버전 1.28 (선호됨), 1.35, 또는 1.75
  • 웹 서버
  • 모듈 특정 컴포넌트 (gd, pdf libs 등등)

PHP 설정의 첫 작업은 configure 스크립트의 명령줄 옵션을 통해서 조정합니다. 사용할 수 있는 옵션 목록과 그에 대한 짧은 설명은 ./configure --help를 실행하여 얻을 수 있습니다. 매뉴얼은 여러 옵션을 나누어 다루고 있습니다. 부록에서 코어 옵션을 볼 수 있고, 홧장 전용 옵션은 레퍼런스 페이지에 설명이 있습니다.

PHP가 설정되면, 바로 모듈과 확장을 빌드할 수 있습니다. make 명령이 이를 수행합니다. 이 명령이 실패하고, 원인을 찾을 수 없다면, 문제 장을 참고하십시오.

add a note add a note

User Contributed Notes 2 notes

up
11
cj3 at clifjackson dot net
6 years ago
I recently ran in to a situation where I was building PHP 7.1.13 from source. Configuration & make went fine, however, when I ran make install it hung. It turns out that if you are building PHP with Apache (apxs) the make file calls apxs with the -a flag which tells it to modify the httpd.conf file. If, for whatever reason, the file is not writeable then it fails and you get the hang.

Line 108 in my Makefile looks like this:

INSTALL_IT = $(mkinstalldirs) '$(INSTALL_ROOT)/usr/lib64/httpd/modules' && $(mkinstalldirs) '$(INSTALL_ROOT)/etc/httpd/conf' && /usr/sbin/apxs -S LIBEXECDIR='$(INSTALL_ROOT)/usr/lib64/httpd/modules'      -S SYSCONFDIR='$(INSTALL_ROOT)/etc/httpd/conf' -i -a -n php7 libphp7.la

I had to remove the -a flag and then it was fine.
up
-20
Arjan van Bentem
17 years ago
When using Red Hat Fedora, beware of Security Enhanced Linux, SELinux.

Quoted from Red Hat: "The security goal is to make sure that Apache HTTP is only reading the static Web content, and not doing anything else such as writing to the content, connecting to database sockets, reading user home directories, etc."

These limitations include, among many other things, using mkdir to create directories, using fopen to access files, using fopen or get_headers to read URLs, or using exec to run external applications that happen to use sockets (or maybe access some files, but which will run fine when executed from the command line as Unix user apache or httpd -- such as HylaFAX "faxstat" as invoked from nweb2fax recvq.php and sendq.php).

See /var/log/messages for any denials due to the SELinux policy. To disable it:

- System, Administration, Security Level and Firewall
- open the SELinux tab
- click the Transition tree
- check Disable SELinux protection for Apache HTTP
- execute /etc/init.d/httpd restart

See also http://fedora.redhat.com/docs/selinux-faq/ and http://php.net/results.php?q=selinux&p=wholesite
To Top