PHPKonf İstanbul PHP Conference 2015

유닉스 시스템에 설치

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 9 notes

packard_bell_nec at hotmail dot com
7 years ago
If you install PHP as an Apache module, you can consider the following. Instead of adding:

application/x-httpd-php    php
application/x-httpd-php-source    phps

into Apache mime.types, you can add:

AddType application/x-httpd-php    .php
AddType application/x-httpd-php-source    .phps

into Apache httpd.conf, OR you can add:

AddHandler application/x-httpd-php    .php
AddHandler application/x-httpd-php-source    .phps

into Apache httpd.conf. The last one is the preferred way of configuration, but it does not work in previous Apache versions.
doug at NOSPAM dot techie dot net
12 years ago
Users compiling under some versions of Solaris/SunOS may encounter the following error.
   symbol ap_block_alarms: referenced symbol not found

To address this problem, add the following additional flag to the Apache build configure line:

So, adding this to the original instructions, you'd configure your Apache build like so:
   ./configure --prefix=/www --enable-module=so --enable-rule=SHARED_CORE

roman4e at gmail dot com
4 years ago
Be careful when compiling on system used with apache2 worker MPM (inl. apache-itk). It will be always compiled with ZTS implicitly when you are using --with-apxs2 and no matter how --enable-maintainer-zts configure option is set
Arjan van Bentem
8 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 and
marshalm at ebrd dot com
14 years ago
HP-UX 11.X PA-RISC installation with oracle (oci8). You need to install the HP-UX patch PHSS_22514 patch (updated, otherwise you will get errors with dlopen() and dlclose() not found during the apache integration stage.
Alex at GrimMusic dot com
8 years ago
I am new to linux/apache/php (coming from server 2003/IIS/Asp.Net), so i was stumped as to why php/apache could only use static content. Also, it couldn't access some documents that you created somewhere else, and then dragged into the HTML directory.

After some research, i found the problem was the SELinux context of the files. It took me forever to find the Proper command to use to change that, as all the examples on the net were out dated using old commands:
# chcon "user_u:object_r:httpd_sys_content_t" /var/www/html -Rc

This will change the SELinux context of all the documents under the /var/www/html directory (which is the web directory under Fedora), to allow the httpd process to access them, and the '-Rc' flag will make the changes Recursive, and will output it's progress for each file that it sucessfully changes.
thansen at terra dot com dot br
11 years ago
The configure directives --with-apxs2 and --with-apxs2filter are not compatible one with other, even though the configure script will not complain about that. Each one affect the way Apache will call the php parser: If you choose the first one, you must use the traditional include:

AddType application/x-httpd-php php

at httpd.conf, to call the parser. If you use the --with-apxs2filter, the include will be:

<Files *.php>
        SetOutputFilter PHP
        SetInputFilter  PHP

, and php will be called as a filter to .php files.

If you use both together, you will get compilation errors (duplicate symbols while linking libphp4).
aryeh dot friedman at gmail dot com
7 years ago
For all multi-core processors (not just Sun as noted above) you need to add --enable-shared-core to the apache config
phpnet at puellae dot com
7 years ago
Further down in the links it talks about using the fPIC option in the compiler to fix the SElinux error.  I messed around with it and adding --with-pic to the configure will also allow the module to load.  I have not done more testing with it but apache at least starts.  If you have already compiled you will need to do a make clean before recompiling.
To Top