본문 바로가기

OS/Linux

[CentOS 7] PHP 설치(APM, Source Compile)

반응형

Apache Installation: https://testtube.tistory.com/33

 

[CentOS 7] Apache HTTP Server/Tomcat 연동(mod_jk, Source Compile)

### Pre-Installation ### # yum install gcc g++ cpp gcc-c++ zlib* curl* openssl openssl-devel ncurses-devel zip2-devel \ libtermcap-devel libc-client-devel perl bison make cmake db4-devel libvpx-devel \ lua-devel wget autoconf libtool Apache Portable Runtim

testtube.tistory.com

MariaDB Installation: https://testtube.tistory.com/31

 

[MariaDB] MariaDB 10.1 Installation on CentOS 7(Source Compile)

1. 사전 준비 # yum -y install net-tools setuptool wget vim-enhanced lrzsz xinetd gcc gcc-c++ ncurses ncurses-devel bison # yum -y install cmake openssl openssl-devel \ libtermcap libtermcap-devel gdbm-devel \ zlib* libxml* freetype* libpng* libjpeg* gd

testtube.tistory.com

 

# yum -y install autoconf automake libtool re2c flex bison libxml2-devel libpng-devel libjpeg-devel \
                 sqlite-devel* oniguruma*



PHP Download: https://www.php.net/downloads

 

PHP: Downloads

Current Stable PHP 8.1.12 (Changelog) php-8.1.12.tar.gz (sig) [19,302Kb] 27 Oct 2022 e0e7c823c9f9aa4c021f5e34ae1a7acafc2a9f3056ca60eb70a8af8f33da3fdf php-8.1.12.tar.bz2 (sig) [15,049Kb] 27 Oct 2022 f87d73e917facf78de7bcde53fc2faa4d4dbe0487a9406e1ab68c8ae8f

www.php.net

# wget https://www.php.net/distributions/php-7.4.4.tar.gz

 

# tar zxvf php-7.4.4.tar.gz
# mkdir build_php
# cd build_php
# ../php-7.4.4/configure --prefix=/app/php \
--with-apxs2=/app/apache/httpd/2.4/bin/apxs \
--with-config-file-path=/app/apache/httpd/2.4/conf \
--with-config-file-scan-dir=/app/apache/httpd/2.4/conf \
--with-openssl=/app/apache/openssl \
--with-mysqli=/app/mysql/bin/mysql_config \
--with-pdo-mysql=/app/mysql \
--with-libdir=lib64 \
--with-iconv \
--with-enchant \
--with-gettext \
--with-zlib \
--with-gmp \
--with-gdbm \
--with-bz2 \
--with-curl \
--with-mhash \
--with-xsl \
--with-readline \
--with-curl \
--with-pear \
--with-gettext \
--with-xmlrpc \
--with-ldap \
--enable-mysqlnd \
--enable-bcmath \
--enable-sockets \
--enable-pcntl \
--enable-ftp \
--enable-bcmath \
--enable-mbstring \
--enable-calendar \
--enable-simplexml \
--enable-json \
--enable-session \
--enable-soap \
--enable-xml \
--enable-opcache \
--enable-intl \
--enable-cli \
--enable-maintainer-zts \
--enable-debug \
--enable-mbregex \
--enable-dba \
--enable-shmop \
--enable-sysvsem \
--enable-sysvshm \
--enable-sysvmsg \
--enable-exif
# make -j `grep processor /proc/cpuinfo | wc -l`
# make test (생략해도 됨)
# make install
# cp -a ../php-7.4.4/php.ini-development /app/apache/httpd/2.4/conf/php.ini

 

# cd /app/apache/httpd/2.4/conf/

 

# vi httpd.conf
Line 270:
DirectoryIndex index.html index.htm index.jsp index.php

Line 384~430:  블록 내부에 다음 추가 혹은 수정(주석제거 등등)
TypesConfig conf/mime.types

AddType application/x-gzip .tgz

AddEncoding x-compress .Z
AddEncoding x-gzip .gz .tgz

AddType application/x-compress .Z
AddType application/x-gzip .gz .tgz

AddType application/x-httpd-php .php7 .php .html .htm .inc
AddType application/x-httpd-php-source .phps

AddHandler cgi-script .cgi

AddHandler type-map var

AddType text/html .shtml
AddOutputFilter INCLUDES .shtml

저장

# vi php.ini
Line 187:
short_open_tag = On 
Line 463:
error_reporting = E_ALL & ~E_NOTICE & ~E_DEPRECATED & ~E_USER_DEPRECATED
Line 958:
date.timezone = Asia/Seoul

저장

# cd /app/apache/httpd/2.4/htdocs

 

# vi info.php
<?
        phpinfo();
?>

저장

아파치 구동후 웹브라우저에서 localhost/info.php 확인

 

 

참고: https://www.php.net/manual/en/configure.about.php

 

PHP: List of core configure options - Manual

List of core configure options Below is a partial list of configure options used by the PHP configure scripts when compiling in Unix-like environments. Most configure options are listed in their appropriate locations on the extension reference pages and no

www.php.net

    https://www.php.net/manual/en/install.unix.apache2.php

 

PHP: Apache 2.x on Unix systems - Manual

for slackware 10.2 users with apache2, mysql5, and trying to install php5:when following the directions above, after this step:./configure --with-apxs2=/usr/local/apache2/bin/apxs --with-mysqli kept getting this error:"Unable to find MySql header files....

www.php.net

 

반응형