Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Select an option

  • Save liyang85/10d220b33a9c96e9199b1903482af203 to your computer and use it in GitHub Desktop.

Select an option

Save liyang85/10d220b33a9c96e9199b1903482af203 to your computer and use it in GitHub Desktop.

Revisions

  1. liyang85 revised this gist Oct 26, 2017. 1 changed file with 2 additions and 0 deletions.
    2 changes: 2 additions & 0 deletions compile-php-5.3.27-and-run-as-fastcgi-mode.sh
    Original file line number Diff line number Diff line change
    @@ -10,6 +10,7 @@ yum install -y \
    libpng-devel \
    libxml2-devel \
    libxslt-devel \
    readline-devel \
    zlib-devel

    # Part 2: yum install from epel
    @@ -64,6 +65,7 @@ cd php-5.3.27
    --with-mysql=/application/mysql \
    --with-openssl \
    --with-png-dir \
    --with-readline \
    --with-xmlrpc \
    --with-xsl \
    --with-zlib
  2. liyang85 renamed this gist Oct 25, 2017. 1 changed file with 0 additions and 0 deletions.
  3. @Liwilly Liwilly revised this gist Jul 24, 2017. 1 changed file with 45 additions and 45 deletions.
    90 changes: 45 additions & 45 deletions compile-php-5.3.27-into-fastcgi-mode.sh
    Original file line number Diff line number Diff line change
    @@ -2,14 +2,14 @@ cd /home/oldboy/tools

    # 1. Install dependencies
    # Part 1: yum install
    yum install -y \
    freetype-devel \
    gd-devel \
    libcurl-devel \
    libjpeg-turbo-devel \
    libpng-devel \
    libxml2-devel \
    libxslt-devel \
    yum install -y \
    freetype-devel \
    gd-devel \
    libcurl-devel \
    libjpeg-turbo-devel \
    libpng-devel \
    libxml2-devel \
    libxslt-devel \
    zlib-devel

    # Part 2: yum install from epel
    @@ -29,43 +29,43 @@ tar xvf php-5.3.27.tar.gz
    cd php-5.3.27

    # 3. Config
    ./configure \
    --prefix=/application/php-5.6.31 \
    --disable-rpath \
    --enable-bcmath \
    --enable-fpm \
    --enable-ftp \
    --enable-gd-native-ttf \
    --enable-inline-optimization \
    --enable-mbregex \
    --enable-mbstring \
    --enable-pcntl \
    --enable-safe-mode \
    --enable-shmop \
    --enable-short-tags \
    --enable-soap \
    --enable-sockets \
    --enable-static \
    --enable-sysvsem \
    --enable-xml \
    --enable-zend-multibyte \
    --enable-zip \
    --with-curl \
    --with-curlwrappers \
    --with-fpm-group=nginx \
    --with-fpm-user=nginx \
    --with-freetype-dir \
    --with-gd \
    --with-iconv-dir=/usr/local/libiconv \
    --with-jpeg-dir \
    --with-libxml-dir=/usr \
    --with-mcrypt \
    --with-mhash \
    --with-mysql=/application/mysql \
    --with-openssl \
    --with-png-dir \
    --with-xmlrpc \
    --with-xsl \
    ./configure \
    --prefix=/application/php-5.3.27 \
    --disable-rpath \
    --enable-bcmath \
    --enable-fpm \
    --enable-ftp \
    --enable-gd-native-ttf \
    --enable-inline-optimization \
    --enable-mbregex \
    --enable-mbstring \
    --enable-pcntl \
    --enable-safe-mode \
    --enable-shmop \
    --enable-short-tags \
    --enable-soap \
    --enable-sockets \
    --enable-static \
    --enable-sysvsem \
    --enable-xml \
    --enable-zend-multibyte \
    --enable-zip \
    --with-curl \
    --with-curlwrappers \
    --with-fpm-group=nginx \
    --with-fpm-user=nginx \
    --with-freetype-dir \
    --with-gd \
    --with-iconv-dir=/usr/local/libiconv \
    --with-jpeg-dir \
    --with-libxml-dir=/usr \
    --with-mcrypt \
    --with-mhash \
    --with-mysql=/application/mysql \
    --with-openssl \
    --with-png-dir \
    --with-xmlrpc \
    --with-xsl \
    --with-zlib

    # 4. Compile php
  4. @Liwilly Liwilly created this gist Jul 24, 2017.
    99 changes: 99 additions & 0 deletions compile-php-5.3.27-into-fastcgi-mode.sh
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,99 @@
    cd /home/oldboy/tools

    # 1. Install dependencies
    # Part 1: yum install
    yum install -y \
    freetype-devel \
    gd-devel \
    libcurl-devel \
    libjpeg-turbo-devel \
    libpng-devel \
    libxml2-devel \
    libxslt-devel \
    zlib-devel

    # Part 2: yum install from epel
    wget -O /etc/yum.repos.d/epel.repo http://mirrors.aliyun.com/repo/epel-6.repo
    yum install -y libmcrypt-devel mcrypt mhash

    # Part 3: compile libiconv
    wget http://ftp.gnu.org/pub/gnu/libiconv/libiconv-1.14.tar.gz
    tar xf libiconv-1.14.tar.gz
    cd libiconv-1.14
    ./configure --prefix=/usr/local/libiconv
    make && make install

    # 2. Download php source tarball and extract it
    wget http://cn2.php.net/get/php-5.3.27.tar.gz/from/this/mirror
    tar xvf php-5.3.27.tar.gz
    cd php-5.3.27

    # 3. Config
    ./configure \
    --prefix=/application/php-5.6.31 \
    --disable-rpath \
    --enable-bcmath \
    --enable-fpm \
    --enable-ftp \
    --enable-gd-native-ttf \
    --enable-inline-optimization \
    --enable-mbregex \
    --enable-mbstring \
    --enable-pcntl \
    --enable-safe-mode \
    --enable-shmop \
    --enable-short-tags \
    --enable-soap \
    --enable-sockets \
    --enable-static \
    --enable-sysvsem \
    --enable-xml \
    --enable-zend-multibyte \
    --enable-zip \
    --with-curl \
    --with-curlwrappers \
    --with-fpm-group=nginx \
    --with-fpm-user=nginx \
    --with-freetype-dir \
    --with-gd \
    --with-iconv-dir=/usr/local/libiconv \
    --with-jpeg-dir \
    --with-libxml-dir=/usr \
    --with-mcrypt \
    --with-mhash \
    --with-mysql=/application/mysql \
    --with-openssl \
    --with-png-dir \
    --with-xmlrpc \
    --with-xsl \
    --with-zlib

    # 4. Compile php
    ln -s /application/mysql/lib/libmysqlclient.so.18 /usr/lib64/
    touch ext/phar/phar.phar
    make
    make install
    ln -s /application/php-5.3.27 /application/php

    # 5. Config php.ini
    cp php.ini-production /application/php/lib/php.ini
    vim /application/php/lib/php.ini
    safe_mode=On # line 338
    expose_php=Off # line 435
    display_errors=Off # line 538
    log_errors=On # line 559
    error_log=/application/logs/php_errors.log # line 643
    register_globals=Off # line 703
    magic_quotes_gpc=On # line 756
    cgi.fix_pathinfo=0 # line 854
    allow_url_fopen=Off # line 902

    # 6. Config php-fpm.conf
    cd /application/php/etc
    cp php-fpm.conf.default php-fpm.conf

    # 7. Start php into fastcgi mode
    /application/php/sbin/php-fpm
    # Check its status
    ps aux | grep php-fpm
    lsof -i :9000