Browse Source

new package

master
parent
commit
27b0f1e7d7
  1. 57
      php-fpm/php-fpm.conf
  2. 24
      php-fpm/php-fpm.ini
  3. 11
      php-fpm/php-fpm.patch
  4. 575
      php-fpm/php-fpm.spec
  5. 59
      php-fpm/rc.php-fpm

57
php-fpm/php-fpm.conf

@ -0,0 +1,57 @@
;;
;; php-fpm.conf -- PHP FastCGI Process Manager (FPM) Configuration
;;
include = @l_prefix@/etc/php-fpm/php-fpm.d/*.conf
[global]
pid = @l_prefix@/var/php-fpm/run/php-fpm.pid
error_log = @l_prefix@/var/php-fpm/log/php-fpm.log
daemonize = yes
emergency_restart_threshold = 4
emergency_restart_interval = 60s
process_control_timeout = 0
process.max = 128
[pool1]
user = openpkg-n
group = openpkg-n
listen = 127.0.0.1:9000
;listen.allowed_clients = 127.0.0.1
pm = dynamic
pm.max_children = 5
pm.start_servers = 2
pm.min_spare_servers = 1
pm.max_spare_servers = 3
pm.max_requests = 1000
pm.status_path = /status
;ping.path = /ping
;ping.response = pong
request_terminate_timeout = 120s
catch_workers_output = no
security.limit_extensions = .php
access.log = @l_prefix@/var/php-fpm/log/php-fpm.access.log
access.format = "%R - %u %t \"%m %r%Q%q\" %s %f %{mili}d %{kilo}M %C%%"
;php_admin_flag[register_globals] = off
;php_admin_flag[allow_url_fopen] = off
;php_flag[display_errors] = off
;php_admin_flag[log_errors] = on
;php_admin_value[max_execution_time] = 60
;php_admin_value[max_input_time] = 60
;php_admin_value[memory_limit] = 128M
;php_admin_value[post_max_size] = 16M
;php_admin_value[realpath_cache_size] = 256K
;php_admin_value[realpath_cache_ttl] = 120
php_admin_value[error_log] = @l_prefix@/var/php-fpm/log/php-fpm.error.log
php_value[sendmail_path] = @l_prefix@/sbin/sendmail -t -i -f openpkg@example.com
;env[PATH] = /bin:/usr/bin:/sbin:/usr/sbin:@l_prefix@/bin:@l_prefix@/sbin
;env[TMPDIR] = /tmp

24
php-fpm/php-fpm.ini

@ -0,0 +1,24 @@
;;
;; php-fpm.ini -- PHP Configuration
;;
[PHP]
; Resource Limits
register_globals = off ; Global variables are no longer registered for input data
allow_url_fopen = off ; Disable the opening of remote URLs
display_errors = off ; Errors will NOT be displayed
log_errors = on ; Errors will be logged
max_execution_time = 60 ; Maximum execution time of each script, in seconds
max_input_time = 60 ; Maximum amount of time each script may spend parsing request data
memory_limit = 128M ; Maximum amount of memory a script may consume
post_max_size = 16M ; Maximum amount of POST data accepted
realpath_cache_size = 256K ; Maximum size of realpath(2) cache
realpath_cache_ttl = 120 ; Duration of time (in seconds) to cache realpath(2) information
; Include Paths
include_path = ".:@l_prefix@/lib/php"
; Session Paths
session.save_path = "@l_prefix@/var/apache/run/apache-php.session"

11
php-fpm/php-fpm.patch

@ -0,0 +1,11 @@
Index: ext/gd/libgd/gd_compat.c
--- ext/gd/libgd/gd_compat.c.orig 2009-08-09 15:15:45 +0200
+++ ext/gd/libgd/gd_compat.c 2010-01-19 21:20:30 +0100
@@ -5,6 +5,7 @@
#endif
#ifdef HAVE_GD_JPG
+# include <stdio.h>
# include <jpeglib.h>
#endif

575
php-fpm/php-fpm.spec

@ -0,0 +1,575 @@
##
## php-fpm.spec -- OpenPKG RPM Package Specification
## Copyright (c) 2000-2012 OpenPKG Foundation e.V. <http://openpkg.net/>
##
## Permission to use, copy, modify, and distribute this software for
## any purpose with or without fee is hereby granted, provided that
## the above copyright notice and this permission notice appear in all
## copies.
##
## THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
## WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
## MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
## IN NO EVENT SHALL THE AUTHORS AND COPYRIGHT HOLDERS AND THEIR
## CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
## SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
## LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
## USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
## ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
## OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
## OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
## SUCH DAMAGE.
##
# package versions
%define V_php 5.4.3
# package information
Name: php-fpm
Summary: Standalone PHP FastCGI Process Manager (FPM)
URL: http://www.php.net/
Vendor: The PHP Project
Packager: OpenPKG Foundation e.V.
Distribution: OpenPKG Community
Class: BASE
Group: Web
License: PHP
Version: %{V_php}
Release: 20120607
# package options
%option with_bc no
%option with_bdb no
%option with_bzip2 no
%option with_calendar no
%option with_ctype no
%option with_curl no
%option with_debug no
%option with_dom no
%option with_exif no
%option with_freetype no
%option with_ftp no
%option with_gd no
%option with_gdbm no
%option with_gettext no
%option with_iconv no
%option with_imap no
%option with_json no
%option with_tokenizer no
%option with_mbregex no
%option with_mbstring no
%option with_mcrypt no
%option with_mhash no
%option with_mm no
%option with_mysql no
%option with_mysqlnd no
%option with_oci8 no
%option with_odbc no
%option with_openldap no
%option with_openldapsasl no
%option with_pear no
%option with_pgsql no
%option with_posix no
%option with_sendmail no
%option with_session no
%option with_simplexml no
%option with_snmp no
%option with_soap no
%option with_sqlite no
%option with_ssl no
%option with_tidy no
%option with_versioning no
%option with_wddx no
%option with_xml no
%option with_xslt no
%option with_zlib no
%option with_zip no
# fixing implicit extension dependencies and correlations
%if "%{with_mm}" == "yes"
%undefine with_session
%define with_session yes
%endif
%if "%{with_pear}" == "yes"
%undefine with_xml
%define with_xml yes
%endif
%if "%{with_freetype}" == "yes"
%undefine with_gd
%define with_gd yes
%endif
%if "%{with_mysql}" == "yes" || "%{with_gd}" == "yes" || "%{with_dom}" == "yes" || "%{with_zip}" == "yes"
%undefine with_zlib
%define with_zlib yes
%endif
%if "%{with_xslt}" == "yes"
%undefine with_dom
%define with_dom yes
%endif
%if "%{with_dom}" == "yes"
%undefine with_xml
%define with_xml yes
%endif
%if "%{with_soap}" == "yes"
%undefine with_xml
%define with_xml yes
%endif
%if "%{with_pgsql}" == "yes"
%undefine with_ssl
%define with_ssl yes
%endif
# list of sources
Source0: http://static.php.net/www.php.net/distributions/php-%{V_php}.tar.bz2
Source1: php-fpm.conf
Source2: php-fpm.ini
Source3: rc.php-fpm
Patch0: php-fpm.patch
# build information
BuildPreReq: OpenPKG, openpkg >= 20100101, gcc, flex, bison
PreReq: OpenPKG, openpkg >= 20100101
BuildPreReq: pcre
PreReq: pcre
%if "%{with_sqlite}" == "yes"
BuildPreReq: sqlite
PreReq: sqlite
%endif
%if "%{with_mysql}" == "yes"
BuildPreReq: mysql
PreReq: mysql
%endif
%if "%{with_pgsql}" == "yes"
BuildPreReq: postgresql
PreReq: postgresql
%endif
%if "%{with_gd}" == "yes"
BuildPreReq: gd >= 2.0.20, jpeg, png
PreReq: gd >= 2.0.20, jpeg, png
%endif
%if "%{with_bdb}" == "yes"
BuildPreReq: db
PreReq: db
%endif
%if "%{with_zlib}" == "yes"
BuildPreReq: zlib
PreReq: zlib
%endif
%if "%{with_bzip2}" == "yes"
BuildPreReq: bzip2
PreReq: bzip2
%endif
%if "%{with_ssl}" == "yes"
BuildPreReq: openssl
PreReq: openssl
%endif
%if "%{with_openldap}" == "yes"
BuildPreReq: openldap
PreReq: openldap
%if "%{with_openldapsasl}" == "yes"
BuildPreReq: openldap::with_sasl = yes
PreReq: openldap::with_sasl = yes
%else
BuildPreReq: openldap::with_sasl = no
PreReq: openldap::with_sasl = no
%endif
%endif
%if "%{with_mm}" == "yes"
BuildPreReq: mm
PreReq: mm
%endif
%if "%{with_freetype}" == "yes"
BuildPreReq: freetype
PreReq: freetype
%endif
%if "%{with_gettext}" == "yes"
BuildPreReq: gettext, libiconv
PreReq: gettext, libiconv
%endif
%if "%{with_iconv}" == "yes"
BuildPreReq: libiconv
PreReq: libiconv
%endif
%if "%{with_imap}" == "yes"
BuildPreReq: imap, openssl
PreReq: imap, openssl
%endif
%if "%{with_xml}" == "yes"
BuildPreReq: libxml
PreReq: libxml
%endif
%if "%{with_xslt}" == "yes"
BuildPreReq: libxslt
PreReq: libxslt
%endif
%if "%{with_dom}" == "yes"
BuildPreReq: libxml, libxslt
PreReq: libxml, libxslt
%endif
%if "%{with_curl}" == "yes"
BuildPreReq: curl
PreReq: curl
%endif
%if "%{with_mhash}" == "yes"
BuildPreReq: mhash
PreReq: mhash
%endif
%if "%{with_mcrypt}" == "yes"
BuildPreReq: libmcrypt
PreReq: libmcrypt
%endif
%if "%{with_gdbm}" == "yes"
BuildPreReq: gdbm, gdbm::with_ndbm = yes
PreReq: gdbm, gdbm::with_ndbm = yes
%endif
%if "%{with_oci8}" == "yes"
BuildPreReq: oracle
PreReq: oracle
%endif
%if "%{with_snmp}" == "yes"
BuildPreReq: snmp
PreReq: snmp
%endif
%if "%{with_odbc}" == "yes"
BuildPreReq: unixodbc
PreReq: unixodbc
%endif
%if "%{with_sendmail}" == "yes"
BuildPreReq: MTA
PreReq: MTA
%endif
%if "%{with_simplexml}" == "yes"
BuildPreReq: libxml
PreReq: libxml
%endif
%if "%{with_tidy}" == "yes"
BuildPreReq: tidy
PreReq: tidy
%endif
%description
PHP is an HTML-embedded scripting language. Much of its syntax is
borrowed from C, Java and Perl with a couple of unique PHP-specific
features thrown in. The goal of the language is to allow web
developers to write dynamically generated pages quickly.
This package provides a Dynamic Shared Object (DSO) for the Apache
HTTP 2.2 web server. In general speaking, this module is also known
as mod_php.
%track
prog php-fpm = {
version = %{V_php}
url = http://www.php.net/downloads.php
regex = php-(5\.\d+\.\d+)\.tar\.(bz2|gz)
}
%prep
%setup -q -n php-%{V_php}
%{l_shtool} subst \
-e 's;-i -a -n php5;-i -n php5;' \
configure
%{l_shtool} subst \
-e 's;\(/include\)/freetype2;\1;' \
configure \
ext/gd/config.m4
%patch -p0
%build
# configure package
case "%{l_platform -t}" in
*-sunos5.10 ) cflags="%{l_cflags}" ;;
* ) cflags="%{l_cflags -O}" ;;
esac
cppflags="%{l_cppflags}"
ldflags="%{l_ldflags}"
libs=""
%if "%{with_gdbm}" == "yes"
libs="$libs -lndbm -lgdbm"
%endif
%if "%{with_gd}" == "yes"
libs="$libs -lpng -lz"
%endif
%if "%{with_gettext}" == "yes"
libs="$libs -liconv"
%endif
%if "%{with_openldap}" == "yes" && "%{with_openldapsasl}" == "yes"
libs="$libs -lsasl2"
%endif
%if "%{with_imap}" == "yes"
libs="$libs -lssl -lcrypto"
%endif
%if "%{with_bdb}" == "yes"
libs="$libs -ldb"
%endif
%if "%{with_pgsql}" == "yes"
libs="$libs `pg_config --libs`"
%endif
%if "%{with_oci8}" == "yes"
ORACLE_HOME="`%{l_rc} --query oracle_home`"
export ORACLE_HOME
%endif
CC="%{l_cc}" \
CFLAGS="$cflags" \
CPPFLAGS="$cppflags" \
LDFLAGS="$ldflags" \
LIBS="$libs" \
%if "%{with_sendmail}" == "yes"
PROG_SENDMAIL="%{l_prefix}/sbin/sendmail" \
%else
PROG_SENDMAIL="`%{l_shtool} path false`" \
%endif
./configure \
--prefix=%{l_prefix} \
--sysconfdir=%{l_prefix}/etc/php-fpm \
--localstatedir=%{l_prefix}/var/php-fpm \
--with-config-file-path=%{l_prefix}/etc/php-fpm \
--libdir=%{l_prefix}/lib/php \
--disable-all \
--enable-pdo \
--enable-filter \
--with-pcre-regex=%{l_prefix} \
%if "%{with_calendar}" == "yes"
--enable-calendar \
%endif
%if "%{with_sqlite}" == "yes"
--with-sqlite3=%{l_prefix} \
--with-pdo-sqlite=%{l_prefix} \
%else
--without-pdo-sqlite \
%endif
%if "%{with_mysql}" == "yes" || "%{with_mysqlnd}" == "yes"
%if "%{with_mysqlnd}" == "yes"
--with-mysql=mysqlnd \
--with-pdo-mysql=mysqlnd \
%else
--with-mysql=%{l_prefix} \
--with-pdo-mysql=%{l_prefix} \
%endif
--with-mysqli=mysqlnd \
--with-mysql-sock=%{l_prefix}/var/mysql/mysql.sock \
%else
--without-mysql \
--without-pdo-mysql \
%endif
%if "%{with_pgsql}" == "yes"
--with-pgsql=%{l_prefix} \
--with-pdo-pgsql=%{l_prefix} \
%else
--without-pgsql \
%endif
%if "%{with_posix}" == "yes"
--enable-posix \
%endif
%if "%{with_gd}" == "yes"
--with-gd=yes \
--with-jpeg-dir=%{l_prefix} \
--with-png-dir=%{l_prefix} \
%endif
%if "%{with_freetype}" == "yes"
--enable-gd-native-ttf \
--with-freetype-dir=%{l_prefix} \
%endif
%if "%{with_bdb}" == "yes"
--with-db4=%{l_prefix} \
%endif
%if "%{with_debug}" == "yes"
--enable-debug \
%else
--disable-debug \
%endif
%if "%{with_zlib}" == "yes"
--with-zlib=%{l_prefix} \
--with-zlib-dir=%{l_prefix} \
%endif
%if "%{with_bzip2}" == "yes"
--with-bz2=%{l_prefix} \
%endif
%if "%{with_ssl}" == "yes" || "%{with_openldap}" == "yes"
--with-openssl=%{l_prefix} \
%endif
%if "%{with_openldap}" == "yes"
--with-ldap=%{l_prefix} \
%endif
%if "%{with_session}" == "yes"
--enable-session \
%endif
%if "%{with_mm}" == "yes"
--with-mm=%{l_prefix} \
%endif
%if "%{with_ftp}" == "yes"
--enable-ftp \
%endif
%if "%{with_oci8}" == "yes"
--with-oci8 \
%endif
%if "%{with_gettext}" == "yes"
--with-gettext=%{l_prefix} \
%endif
%if "%{with_imap}" == "yes"
--with-imap=%{l_prefix} \
--with-imap-ssl=%{l_prefix} \
%endif
%if "%{with_json}" == "yes"
--enable-json \
%else
--disable-json \
%endif
%if "%{with_tokenizer}" == "yes"
--enable-tokenizer \
%else
--disable-tokenizer \
%endif
%if "%{with_xml}" == "yes"
--enable-xml \
--enable-xmlreader \
--enable-libxml \
--with-libxml-dir=%{l_prefix} \
%else
--disable-xml \
%endif
%if "%{with_xslt}" == "yes"
--with-xsl=%{l_prefix} \
%else
--without-xsl \
%endif
%if "%{with_dom}" == "yes"
--enable-dom \
%else
--disable-dom \
%endif
%if "%{with_wddx}" == "yes"
--enable-wddx \
%endif
%if "%{with_soap}" == "yes"
--enable-soap \
%endif
%if "%{with_bc}" == "yes"
--enable-bcmath \
%endif
%if "%{with_mhash}" == "yes"
--with-mhash=%{l_prefix} \
%endif
%if "%{with_mcrypt}" == "yes"
--with-mcrypt=%{l_prefix} \
%endif
%if "%{with_ctype}" == "yes"
--enable-ctype \
%endif
%if "%{with_curl}" == "yes"
--with-curl=%{l_prefix} \
%endif
%if "%{with_gdbm}" == "yes"
--with-gdbm=%{l_prefix} \
%endif
%if "%{with_versioning}" == "yes"
--enable-versioning \
%endif
%if "%{with_pear}" == "yes"
--with-pear=%{l_prefix}/lib/php \
%else
--without-pear \
%endif
%if "%{with_simplexml}" == "yes"
--enable-simplexml \
--enable-libxml \
--with-libxml-dir=%{l_prefix} \
%else
--disable-simplexml \
%endif
%if "%{with_snmp}" == "yes"
--with-snmp=%{l_prefix} \
--with-openssl-dir=%{l_prefix} \
%endif
%if "%{with_odbc}" == "yes"
--with-unixODBC=%{l_prefix} \
--with-pdo-odbc=unixODBC,%{l_prefix} \
%endif
%if "%{with_mbregex}" == "yes"
--enable-mbregex \
%endif
%if "%{with_mbstring}" == "yes"
--enable-mbstring \
%endif
%if "%{with_exif}" == "yes"
--with-exif \
%endif
%if "%{with_iconv}" == "yes"
--with-iconv=%{l_prefix} \
%endif
%if "%{with_tidy}" == "yes"
--with-tidy=%{l_prefix} \
%else
--without-tidy \
%endif
%if "%{with_zip}" == "yes"
--enable-zip \
%endif
--enable-fpm \
--with-fpm-user=%{l_nusr} \
--with-fpm-group=%{l_ngrp} \
--disable-cli \
--disable-cgi
# build package
%{l_make} %{l_mflags}
%install
# install package (seems to do nothing for php-fpm case)
%{l_make} %{l_mflags} install-sapi INSTALL_ROOT=$RPM_BUILD_ROOT
# install PHP-FPM
%{l_shtool} mkdir -f -p -m 755 \
$RPM_BUILD_ROOT%{l_prefix}/sbin \
$RPM_BUILD_ROOT%{l_prefix}/man/man8
%{l_shtool} install -c -s -m 755 \
sapi/fpm/php-fpm $RPM_BUILD_ROOT%{l_prefix}/sbin/
%{l_shtool} install -c -m 644 \
sapi/fpm/php-fpm.8 $RPM_BUILD_ROOT%{l_prefix}/man/man8/
# install run-command script
%{l_shtool} mkdir -f -p -m 755 \
$RPM_BUILD_ROOT%{l_prefix}/etc/rc.d
%{l_shtool} install -c -m 644 %{l_value -s -a} \
%{SOURCE rc.php-fpm} \
$RPM_BUILD_ROOT%{l_prefix}/etc/rc.d/
# install default configuration file
%{l_shtool} mkdir -f -p -m 755 \
$RPM_BUILD_ROOT%{l_prefix}/etc/php-fpm
%{l_shtool} install -c -m 644 %{l_value -s -a} \
%{SOURCE php-fpm.conf} \
$RPM_BUILD_ROOT%{l_prefix}/etc/php-fpm/
%{l_shtool} install -c -m 644 %{l_value -s -a} \
%{SOURCE php-fpm.ini} \
$RPM_BUILD_ROOT%{l_prefix}/etc/php-fpm/
# create run-time directories
%{l_shtool} mkdir -f -p -m 755 \
$RPM_BUILD_ROOT%{l_prefix}/var/php-fpm/run \
$RPM_BUILD_ROOT%{l_prefix}/var/php-fpm/log
%if "%{with_session}" == "yes"
%{l_shtool} mkdir -f -p -m 755 \
$RPM_BUILD_ROOT%{l_prefix}/var/php-fpm/run/php-fpm.session
%endif
# determine installation files
%{l_rpmtool} files -v -ofiles -r$RPM_BUILD_ROOT %{l_files_std} \
'%attr(-,%{l_nusr},%{l_ngrp}) %{l_prefix}/var/php-fpm/*' \
%if "%{with_session}" == "yes"
'%attr(0750,%{l_nusr},%{l_ngrp}) %{l_prefix}/var/php-fpm/run/php-fpm.session' \
%endif
'%config %{l_prefix}/etc/php-fpm/php-fpm.ini' \
'%config %{l_prefix}/etc/php-fpm/php-fpm.conf'
%files -f files
%clean
%post
# after upgrade, restart service
[ $1 -eq 2 ] || exit 0
eval `%{l_rc} php-fpm status 2>/dev/null`
[ ".$php_fpm_active" = .yes ] && %{l_rc} php-fpm restart
exit 0

59
php-fpm/rc.php-fpm

@ -0,0 +1,59 @@
#!@l_prefix@/bin/openpkg rc
##
## rc.php-fpm -- Run-Commands
##
%config
php_fpm_enable="$openpkg_rc_def"
php_fpm_log_prolog="true"
php_fpm_log_epilog="true"
php_fpm_log_numfiles="10"
php_fpm_log_minsize="1M"
php_fpm_log_complevel="9"
%common
php_fpm_inifile="@l_prefix@/etc/php-fpm/php-fpm.ini"
php_fpm_cfgfile="@l_prefix@/etc/php-fpm/php-fpm.conf"
php_fpm_pidfile="@l_prefix@/var/php-fpm/run/php-fpm.pid"
php_fpm_logfile="@l_prefix@/var/php-fpm/log/php-fpm.log"
php_fpm_signal () {
[ -f $php_fpm_pidfile ] && kill -$1 `cat $php_fpm_pidfile`
}
%status -u @l_susr@ -o
php_fpm_usable="unknown"
php_fpm_active="no"
rcService php-fpm enable yes && \
php_fpm_signal 0 && php_fpm_active="yes"
echo "php_fpm_enable=\"$php_fpm_enable\""
echo "php_fpm_usable=\"$php_fpm_usable\""
echo "php_fpm_active=\"$php_fpm_active\""
%start -u @l_susr@
rcService php-fpm enable yes || exit 0
rcService php-fpm active yes && exit 0
@l_prefix@/sbin/php-fpm \
-c "$php_fpm_inifile" \
-y "$php_fpm_cfgfile"
%stop -u @l_susr@
rcService php-fpm enable yes || exit 0
rcService php-fpm active no && exit 0
php_fpm_signal TERM
sleep 2
rm -f $php_fpm_pidfile >/dev/null 2>&1 || true
%restart -u @l_susr@
rcService php-fpm enable yes || exit 0
rcService php-fpm active no && exit 0
rc php_fpm stop start
%daily -u @l_susr@
rcService php-fpm enable yes || exit 0
shtool rotate -f \
-n ${php_fpm_log_numfiles} -s ${php_fpm_log_minsize} -d \
-z ${php_fpm_log_complevel} -m 664 -o @l_nusr@ -g @l_ngrp@ \
-P "${php_fpm_log_prolog}" \
-E "${php_fpm_log_epilog}; rc php_fpm restart" \
$php_fpm_logfile
Loading…
Cancel
Save