Bug in 0.5.7, --with-fpm-log related

40 views
Skip to first unread message

Floren Munteanu

unread,
Mar 29, 2008, 10:40:59 PM3/29/08
to highload-php-en, andreini...@gmail.com
Hi Andrei,

I noticed an error, if you define the --with-fpm-log param, while
building an RPM. If I build the php-cgi executable with:
--enable-fpm \
--with-fpm-conf=%{_sysconfdir}/php-fpm.conf \
--with-fpm-log=%{_localstatedir}/log/php-fpm/worker.log \
--with-fpm-pid=%{_localstatedir}/run/php-fpm.pid \

I get this error:
---
/home/floren/redhat/el5/BUILD/php-5.2.5/main/streams/cast.c:129:
error: expected '=', ',', ';', 'asm' or '__attribute__' before
'stream_cookie_functions'
/home/floren/redhat/el5/BUILD/php-5.2.5/main/streams/cast.c: In
function '_php_stream_cast':
/home/floren/redhat/el5/BUILD/php-5.2.5/main/streams/cast.c:181:
error: 'stream_cookie_functions' undeclared (first use in this
function)
/home/floren/redhat/el5/BUILD/php-5.2.5/main/streams/cast.c:181:
error: (Each undeclared identifier is reported only once
/home/floren/redhat/el5/BUILD/php-5.2.5/main/streams/cast.c:181:
error: for each function it appears in.)
/home/floren/redhat/el5/BUILD/php-5.2.5/main/streams/cast.c:181:
warning: assignment makes pointer from integer without a cast
make: *** [main/streams/cast.lo] Error 1
make: *** Waiting for unfinished jobs....
error: Bad exit status from /var/tmp/rpm-tmp.67343 (%build)
---

Now, if I build the php-cgi executable with:
--enable-fpm \
--with-fpm-conf=%{_sysconfdir}/php-fpm.conf \
--with-fpm-pid=%{_localstatedir}/run/php-fpm.pid \

everything is OK.

I'm building the RPM on CentOS 5.1, i386. I applied your patch to the
SAPI file. Thanks for your help.

Andrei Nigmatulin

unread,
Mar 30, 2008, 8:04:02 AM3/30/08
to highload-php-en

This is very strange, because php-fpm does not change a single byte in
main/streams/cast.c file.

Can you give me the output of

$ grep COOKIE main/php_config.h

just after error happened, please ?


--
Andrei Nigmatulin
GPG PUB KEY 6449830D

Now I lay me down to sleep(3)
Pray the OS my core to keep
If I die before I wake
Pray the Disk my core to take

Floren Munteanu

unread,
Mar 30, 2008, 9:57:39 AM3/30/08
to highload-php-en
On Mar 30, 8:04 am, Andrei Nigmatulin <andrei.nigmatu...@gmail.com>
wrote:
> This is very strange, because php-fpm does not change a single byte in
> main/streams/cast.c file.
>
> Can you give me the output of
>
> $ grep COOKIE main/php_config.h
>
> just after error happened, please ?

/bin/sh /home/floren/redhat/el5/BUILD/php-5.2.5/build-cgi/libtool --
silent --preserve-dup-deps --mode=compile gcc -Imain/streams/ -I/home/
floren/redhat/el5/BUILD/php-5.2.5/main/streams/ -DPHP_ATOM_INC -I/home/
floren/redhat/el5/BUILD/php-5.2.5/build-cgi/include -I/home/floren/
redhat/el5/BUILD/php-5.2.5/build-cgi/main -I/home/floren/redhat/el5/
BUILD/php-5.2.5 -I/usr/include/libxml2 -I/usr/kerberos/include -I/home/
floren/redhat/el5/BUILD/php-5.2.5/build-cgi/ext/date/lib -I/home/
floren/redhat/el5/BUILD/php-5.2.5/ext/date/lib -I/usr/include/
freetype2 -I/usr/include/imap -I/home/floren/redhat/el5/BUILD/
php-5.2.5/ext/mbstring/oniguruma -I/home/floren/redhat/el5/BUILD/
php-5.2.5/build-cgi/ext/mbstring/oniguruma -I/home/floren/redhat/el5/
BUILD/php-5.2.5/ext/mbstring/libmbfl -I/home/floren/redhat/el5/BUILD/
php-5.2.5/build-cgi/ext/mbstring/libmbfl -I/home/floren/redhat/el5/
BUILD/php-5.2.5/ext/mbstring/libmbfl/mbfl -I/home/floren/redhat/el5/
BUILD/php-5.2.5/build-cgi/ext/mbstring/libmbfl/mbfl -I/usr/include/
mysql -I/usr/include/ncurses -I/usr/include/pspell -I/home/floren/
redhat/el5/BUILD/php-5.2.5/build-cgi/TSRM -I/home/floren/redhat/el5/
BUILD/php-5.2.5/build-cgi/Zend -I/home/floren/redhat/el5/BUILD/
php-5.2.5/main -I/home/floren/redhat/el5/BUILD/php-5.2.5/Zend -I/home/
floren/redhat/el5/BUILD/php-5.2.5/TSRM -I/home/floren/redhat/el5/BUILD/
php-5.2.5/build-cgi/ -I/usr/include -O2 -g -march=i386 -mcpu=i686 -
fno-strict-aliasing -c /home/floren/redhat/el5/BUILD/php-5.2.5/main/
streams/cast.c -o main/streams/cast.lo
`-mcpu=' is deprecated. Use `-mtune=' or '-march=' instead.

-- error start --

/home/floren/redhat/el5/BUILD/php-5.2.5/main/streams/cast.c:129:
error: expected '=', ',', ';', 'asm' or '__attribute__' before
'stream_cookie_functions'
/home/floren/redhat/el5/BUILD/php-5.2.5/main/streams/cast.c: In
function '_php_stream_cast':
/home/floren/redhat/el5/BUILD/php-5.2.5/main/streams/cast.c:181:
error: 'stream_cookie_functions' undeclared (first use in this
function)
/home/floren/redhat/el5/BUILD/php-5.2.5/main/streams/cast.c:181:
error: (Each undeclared identifier is reported only once
/home/floren/redhat/el5/BUILD/php-5.2.5/main/streams/cast.c:181:
error: for each function it appears in.)
/home/floren/redhat/el5/BUILD/php-5.2.5/main/streams/cast.c:181:
warning: assignment makes pointer from integer without a cast
make: *** [main/streams/cast.lo] Error 1
make: *** Waiting for unfinished jobs....
error: Bad exit status from /var/tmp/rpm-tmp.15524 (%build)


RPM build errors:
Bad exit status from /var/tmp/rpm-tmp.15524 (%build)
[floren@localhost ~]$ cd /home/floren/redhat/el5/BUILD/php-5.2.5
[floren@localhost php-5.2.5]$ grep COOKIE main/php_config.h
grep: main/php_config.h: No such file or directory
[floren@localhost php-5.2.5]$ grep COOKIE main/php_config.h.in
#undef HAVE_FOPENCOOKIE
#undef COOKIE_IO_FUNCTIONS_T
#undef COOKIE_SEEKER_USES_OFF64_T
[floren@localhost php-5.2.5]$ grep COOKIE main/php_config.h.in.fpm
#undef HAVE_FOPENCOOKIE
#undef COOKIE_IO_FUNCTIONS_T
#undef COOKIE_SEEKER_USES_OFF64_T

Floren Munteanu

unread,
Mar 30, 2008, 10:00:12 AM3/30/08
to highload-php-en
The rpm-tmp:
---

#!/bin/sh

RPM_SOURCE_DIR="/home/floren/redhat/el5/SOURCES"
RPM_BUILD_DIR="/home/floren/redhat/el5/BUILD"
RPM_OPT_FLAGS="-O2 -g -march=i386 -mcpu=i686"
RPM_ARCH="i386"
RPM_OS="linux"
export RPM_SOURCE_DIR RPM_BUILD_DIR RPM_OPT_FLAGS RPM_ARCH RPM_OS
RPM_DOC_DIR="/usr/share/doc"
export RPM_DOC_DIR
RPM_PACKAGE_NAME="php"
RPM_PACKAGE_VERSION="5.2.5"
RPM_PACKAGE_RELEASE="3.el5"
export RPM_PACKAGE_NAME RPM_PACKAGE_VERSION RPM_PACKAGE_RELEASE
RPM_BUILD_ROOT="/var/tmp/php-5.2.5-3.el5-root"
export RPM_BUILD_ROOT


set -x
umask 022
cd /home/floren/redhat/el5/BUILD
cd php-5.2.5
# Force use of system libtool:
libtoolize --force --copy
/bin/cat `aclocal --print-ac-dir`/libtool.m4 > build/libtool.m4

# Regenerate configure scripts (patches change config.m4's)
./buildconf --force

CFLAGS="$RPM_OPT_FLAGS -fno-strict-aliasing"
export CFLAGS

# Install extension modules in /usr/lib/php/modules
EXTENSION_DIR=/usr/lib/php/modules
export EXTENSION_DIR

# Set PEAR_INSTALLDIR to ensure that the hard-coded include_path
# includes the PEAR directory even though pear is packaged
# separately.
PEAR_INSTALLDIR=/usr/share/pear
export PEAR_INSTALLDIR

# Shell function to configure and build a PHP tree.
build() {
# bison-1.875-2 seems to produce a broken parser; workaround.
/bin/mkdir Zend && /bin/cp ../Zend/
zend_{language,ini}_{parser,scanner}.[ch] Zend
ln -s -f ../configure

CFLAGS="${CFLAGS:--O2 -g -march=i386 -mcpu=i686}" ; export CFLAGS ;
CXXFLAGS="${CXXFLAGS:--O2 -g -march=i386 -mcpu=i686}" ; export
CXXFLAGS ;
FFLAGS="${FFLAGS:--O2 -g -march=i386 -mcpu=i686}" ; export FFLAGS ;
./configure --host=i686-redhat-linux-gnu --build=i686-redhat-linux-
gnu \
--target=i386-redhat-linux \
--program-prefix= \
--prefix=/usr \
--exec-prefix=/usr \
--bindir=/usr/bin \
--sbindir=/usr/sbin \
--sysconfdir=/etc \
--datadir=/usr/share \
--includedir=/usr/include \
--libdir=/usr/lib \
--libexecdir=/usr/libexec \
--localstatedir=/var \
--sharedstatedir=/usr/com \
--mandir=/usr/share/man \
--infodir=/usr/share/info \
--cache-file=../config.cache \
--with-libdir=/lib \
--with-config-file-path=/etc \
--with-config-file-scan-dir=/etc/php.d \
--disable-debug \
--with-pic \
--disable-rpath \
--without-pear \
--with-bz2 \
--with-curl \
--with-exec-dir=/usr/bin \
--with-freetype-dir=/usr \
--with-png-dir=/usr \
--enable-gd-native-ttf \
--without-gdbm \
--with-gettext \
--with-gmp \
--with-iconv \
--with-jpeg-dir=/usr \
--with-openssl \
--with-png \
--with-pspell \
--with-expat-dir=/usr \
--with-pcre-regex=/usr \
--with-zlib \
--with-layout=GNU \
--enable-exif \
--enable-ftp \
--enable-magic-quotes \
--enable-sockets \
--enable-sysvsem --enable-sysvshm --enable-sysvmsg \
--enable-track-vars \
--enable-trans-sid \
--enable-yp \
--enable-wddx \
--with-kerberos \
--enable-ucd-snmp-hack \
--with-unixODBC=shared,/usr \
--enable-shmop \
--enable-calendar \
--enable-dbx \
--enable-dio \
--without-mime-magic \
--without-sqlite \
--with-libxml-dir=/usr \
--with-xml \
$*
if [ test $? != 0 ]; then
tail -500 config.log
: configure failed
exit 1
fi

/usr/bin/make -j2
}

# Build /usr/bin/php-cgi with the CGI SAPI, and all the shared
extensions
pushd build-cgi
build \
--enable-force-cgi-redirect \
--enable-pcntl \
--with-imap=shared --with-imap-ssl \
--enable-mbstring=shared --enable-mbstr-enc-trans \
--enable-mbregex \
--with-ncurses=shared \
--with-gd=shared \
--enable-bcmath=shared \
--enable-dba=shared --with-db4=/usr \
--with-xmlrpc=shared \
--with-ldap=shared --with-ldap-sasl \
--with-mysql=shared,/usr \
--with-mysqli=shared,/usr/bin/mysql_config \
--enable-dom=shared \
--with-dom-xslt=/usr --with-dom-exslt=/usr \
--with-pgsql=shared \
--with-snmp=shared,/usr \
--enable-soap=shared \
--with-xsl=shared,/usr \
--enable-xmlreader=shared --enable-xmlwriter=shared \
--enable-fastcgi \
--enable-fpm \
--with-fpm-conf=/etc/php-fpm.conf \
--with-fpm-log=/var/log/php-fpm/worker.log \
--with-fpm-pid=/var/run/php-fpm.pid \
--enable-pdo=shared \
--with-pdo-odbc=shared,unixODBC,/usr \
--with-pdo-mysql=shared,/usr \
--with-pdo-pgsql=shared,/usr \
--with-pdo-sqlite=shared,/usr \
--enable-json=shared \
--enable-zip=shared \
--with-readline
popd


exit 0

Andrei Nigmatulin

unread,
Mar 30, 2008, 10:15:40 AM3/30/08
to highloa...@googlegroups.com
On Sunday 30 March 2008 17:57, Floren Munteanu wrote:
> On Mar 30, 8:04 am, Andrei Nigmatulin <andrei.nigmatu...@gmail.com>
>
> wrote:
> > This is very strange, because php-fpm does not change a single byte in
> > main/streams/cast.c file.
> >
> > Can you give me the output of
> >
> > $ grep COOKIE main/php_config.h
> >
> > just after error happened, please ?
>
> RPM build errors:
> Bad exit status from /var/tmp/rpm-tmp.15524 (%build)
> [floren@localhost ~]$ cd /home/floren/redhat/el5/BUILD/php-5.2.5
> [floren@localhost php-5.2.5]$ grep COOKIE main/php_config.h
> grep: main/php_config.h: No such file or directory

$ cd /home/floren/redhat/el5/BUILD/php-5.2.5/build-cgi
$ grep COOKIE main/php_config.h


BTW, do you use any other patches besides php-fpm ?

Floren Munteanu

unread,
Mar 30, 2008, 10:52:49 AM3/30/08
to highload-php-en
Yes. This is basically a customized RPM, based on the CentOS rpm. All
patches are:
---
Patch1: php-5.2.4-gnusrc.patch
Patch2: php-4.3.3-install.patch
Patch3: php-5.2.4-norpath.patch
Patch5: php-5.0.2-phpize64.patch
Patch8: php-5.2.0-includedir.patch
Patch9: php-5.2.4-embed.patch
Patch21: php-5.2.4-odbc.patch
Patch22: php-4.3.11-shutdown.patch
Patch30: php-5.0.4-dlopen.patch
Patch31: php-5.2.4-easter.patch
Patch51: php-5.0.4-tests-wddx.patch
Patch52: php-5.2.4-tests.patch
Patch60: php-5.2.5-sapi.patch
Patch61: php-5.2.5-fpm-0.5.7.patch

I made my own patch, based on your instructions:
php-5.2.5-sapi.patch
---
--- php-5.2.5/main/SAPI.c.orig 2007-05-25 05:20:01.000000000 -0400
+++ php-5.2.5/main/SAPI.c 2008-03-29 04:22:30.000000000 -0400
@@ -301,6 +301,7 @@

/* SG(sapi_headers).http_response_code = 200; */
SG(sapi_headers).http_status_line = NULL;
+ SG(sapi_headers).mimetype = NULL;
SG(read_post_bytes) = 0;
SG(request_info).post_data = NULL;
SG(request_info).raw_post_data = NULL;
@@ -340,6 +341,7 @@
SG(sapi_headers).http_response_code = 200;
*/
SG(sapi_headers).http_status_line = NULL;
+ SG(sapi_headers).mimetype = NULL;
SG(headers_sent) = 0;
SG(read_post_bytes) = 0;
SG(request_info).post_data = NULL;

Andrei Nigmatulin

unread,
Mar 30, 2008, 10:59:16 AM3/30/08
to highloa...@googlegroups.com
Okay, and what

$ cd /home/floren/redhat/el5/BUILD/php-5.2.5/build-cgi
$ grep COOKIE main/php_config.h

shows ?

--

Floren Munteanu

unread,
Mar 30, 2008, 11:17:10 AM3/30/08
to highload-php-en
$ cd /home/floren/redhat/el5/BUILD/php-5.2.5/build-cgi
$ grep COOKIE main/php_config.h
#define COOKIE_IO_FUNCTIONS_T cookie_io_functions_t
#define COOKIE_SEEKER_USES_OFF64_T 1
#define HAVE_FOPENCOOKIE 1

Andrei, I fixed the problem. :)
It was not your patch.. but the CentOS guys.
I just did a crosscheck on all configuration options and discovered a
bunch of options, non-relevant to PHP 5.2.5 version:

--with-png
--with-expat-dir=/usr
--enable-track-vars
--enable-trans-sid
--enable-yp
--enable-dbx
--enable-dio
--with-xml
--enable-mbstr-enc-trans
--with-dom-xslt=/usr
--with-dom-exslt=/usr

They were probably leftovers from other patches or builds?
Anyways, I can compile properly the RPM, once those options removed.
I'm recompiling again, just to make sure... so far so good.

I will let you know in 5min if the second recompile worked fine also.
The cleaned rpm-tmp is:
--with-pspell \
--with-pcre-regex=/usr \
--with-zlib \
--with-layout=GNU \
--enable-exif \
--enable-ftp \
--enable-magic-quotes \
--enable-sockets \
--enable-sysvsem --enable-sysvshm --enable-sysvmsg \
--enable-wddx \
--with-kerberos \
--enable-ucd-snmp-hack \
--with-unixODBC=shared,/usr \
--enable-shmop \
--enable-calendar \
--without-mime-magic \
--without-sqlite \
--with-libxml-dir=/usr \
$*
if [ test $? != 0 ]; then
tail -500 config.log
: configure failed
exit 1
fi

/usr/bin/make -j2
}

# Build /usr/bin/php-cgi with the CGI SAPI, and all the shared
extensions
pushd build-cgi
build \
--enable-force-cgi-redirect \
--enable-pcntl \
--with-imap=shared --with-imap-ssl \
--enable-mbstring=shared \
--enable-mbregex \
--with-ncurses=shared \
--with-gd=shared \
--enable-bcmath=shared \
--enable-dba=shared --with-db4=/usr \
--with-xmlrpc=shared \
--with-ldap=shared --with-ldap-sasl \
--with-mysql=shared,/usr \
--with-mysqli=shared,/usr/bin/mysql_config \
--enable-dom=shared \

Floren Munteanu

unread,
Mar 30, 2008, 11:21:01 AM3/30/08
to highload-php-en
Hmm, I still have the problem. :(

$ cd /home/floren/redhat/el5/BUILD/php-5.2.5/build-cgi
$ grep COOKIE main/php_config.h
#define HAVE_FOPENCOOKIE 1

Andrei Nigmatulin

unread,
Mar 30, 2008, 11:43:51 AM3/30/08
to highloa...@googlegroups.com

The problem is with this patch:

php-5.2.4-gnusrc.patch

It removes _GNU_SOURCE macro from cast.c:

--- php-5.2.4/main/streams/cast.c.gnusrc
+++ php-5.2.4/main/streams/cast.c
@@ -18,7 +18,6 @@

/* $Id: cast.c,v 1.12.2.1.2.1 2007/01/01 09:36:11 sebastian Exp $ */

-#define _GNU_SOURCE
#include "php.h"
#include "php_globals.h"
#include "php_network.h"

And glibc fopencookie() code somehow depends on this macro. Try to ask CentOS
guys to fix it, because I absolutely have no idea why the patch exists.

Antony Dovgal

unread,
Mar 30, 2008, 11:52:11 AM3/30/08
to highloa...@googlegroups.com
On 30.03.2008 19:43, Andrei Nigmatulin wrote:
> -#define _GNU_SOURCE
> #include "php.h"
> #include "php_globals.h"
> #include "php_network.h"
>
> And glibc fopencookie() code somehow depends on this macro. Try to ask CentOS
> guys to fix it, because I absolutely have no idea why the patch exists.

.. as well as most of the other patches.
They should be either included into the mainstream or CentOS maintainers should stop calling it "PHP":
-----
3. The name "PHP" must not be used to endorse or promote products
derived from this software without prior written permission. For
written permission, please contact gr...@php.net.
-----

Including distribution specific patches is one thing, changing the behavior
and effectively breaking working code is another.

--
Wbr,
Antony Dovgal

Floren Munteanu

unread,
Mar 30, 2008, 5:39:32 PM3/30/08
to highload-php-en
Thanks Andrei and Tony. :)
I got it working. First I tossed the php-5.2.4-gnusrc.patch file.
Then, I tweaked the RPM to match my needs:
1. I followed Tony's smart advice and renamed all php-fpm related
variables to fcgipm.
2. In the RPM, I used this logic:
build \

...

--enable-fpm \
--with-fpm-conf=%{_sysconfdir}/fcgipm/fcgipm.conf \
--with-fpm-log=%{_localstatedir}/log/fcgipm/process.log \
--with-fpm-pid=%{_localstatedir}/run/fcgipm.pid \

...

# Install the default FastCGI process manager files
%{__install} -m 0755 -d %{buildroot}%{_sysconfdir}/fcgipm
%{__install} -m 0644 %{SOURCE2} %{buildroot}%{_sysconfdir}/fcgipm/
fcgipm.conf
%{__install} -m 0644 build-cgi/sapi/cgi/fpm/php-fpm.conf %{buildroot}%
{_sysconfdir}/fcgipm/fcgipm.conf.default
%{__rm} -rf %{buildroot}%{_sysconfdir}/fcgipm/php-fpm.conf
%{__mkdir_p} %{buildroot}%{_initrddir}
%{__install} -m 0755 %{SOURCE3} %{buildroot}%{_initrddir}/fcgipm
%{__rm} -rf %{buildroot}%{_sbindir}/php-fpm
%{__install} -m 0755 -d %{buildroot}%{_localstatedir}/log/fcgipm
%{__mkdir_p} %{buildroot}%{_sysconfdir}/logrotate.d
%{__install} -m 0644 %{SOURCE4} %{buildroot}%{_sysconfdir}/logrotate.d/
fcgipm
touch %{buildroot}%{_localstatedir}/log/fcgipm/process.log

...

%pre cli
%{_sbindir}/useradd -s /sbin/nologin -M -r -d %{userdir} \
-c "FastCGI Process Manager" fcgipm &>/dev/null || :


%preun cli
if [ $1 -eq 0 ]; then
/sbin/service fcgipm stop &>/dev/null || :
/sbin/chkconfig --del fcgipm
fi


%post cli
if [ $1 -ge 1 ]; then
/sbin/chkconfig --add fcgipm
fi


%postun cli
if [ $1 -ge 1 ]; then
/sbin/service fcgipm condrestart &>/dev/null || :
fi
if [ $1 -eq 0 ] ; then
%{_sbindir}/userdel fcgipm >/dev/null 2>&1 || :
fi

...

%files cli
%defattr(-,root,root,-)
%dir %{_localstatedir}/log/fcgipm
%dir %{_sysconfdir}/fcgipm
%{_bindir}/php
%{_bindir}/php-cgi
%attr(0640,fcgipm,fcgipm) %config(noreplace) %{_localstatedir}/log/
fcgipm/process.log
%config(noreplace) %{_initrddir}/fcgipm
%config(noreplace) %{_sysconfdir}/fcgipm/fcgipm.*
%config(noreplace) %{_sysconfdir}/logrotate.d/fcgipm
%{_mandir}/man1/php.1*

I dropped Andrei's init script and used my own. It uses the init.d/
functions.
However, I have a question for you Andrei. To what directory should I
point the fcgipm user? Right now I set it as /var/log/fcgipm

Floren Munteanu

unread,
Mar 30, 2008, 6:09:28 PM3/30/08
to highload-php-en
I forgot to mention that I will assign this user to deal with workers:
<value name="listen_options">
<value name="backlog">-1</value>
<value name="owner">fcgipm</value>
<value name="group">fcgipm</value>
<value name="mode">0666</value>
</value>
...
<value name="user">fcgipm</value>
<value name="group">fcgipm</value>

Thanks for your help, Andrei.

Andrei Nigmatulin

unread,
Mar 30, 2008, 6:17:00 PM3/30/08
to highloa...@googlegroups.com
On Monday 31 March 2008 01:39, Floren Munteanu wrote:
> Thanks Andrei and Tony. :)
> I got it working. First I tossed the php-5.2.4-gnusrc.patch file.

> I dropped Andrei's init script and used my own. It uses the init.d/


> functions.
> However, I have a question for you Andrei. To what directory should I
> point the fcgipm user? Right now I set it as /var/log/fcgipm

You're talking about $HOME directory ? I believe it does matter only when you
run external commands from php. They sometimes want to have access to
dot-files in $HOME. In this case you should set up correct home directory
with appropriate permissions.

Andrei Nigmatulin

unread,
Mar 30, 2008, 6:30:52 PM3/30/08
to highloa...@googlegroups.com
On Monday 31 March 2008 02:09, Floren Munteanu wrote:
> I forgot to mention that I will assign this user to deal with workers:
> <value name="listen_options">
> <value name="backlog">-1</value>
> <value name="owner">fcgipm</value>
> <value name="group">fcgipm</value>
> <value name="mode">0666</value>
> </value>

Setting the above only makes sense if you're
- running linux
- using unix socket between web server and php-fastcgi
- need to restrict access to socket in file system from any processes other
than web server.
The 'owner', 'group' and 'mode' must be set in order to allow connect(2)'s
from web server's process uid/gid.

> ...
> <value name="user">fcgipm</value>
> <value name="group">fcgipm</value>

--

Floren Munteanu

unread,
Mar 30, 2008, 7:59:58 PM3/30/08
to highload-php-en
On Mar 30, 6:17 pm, Andrei Nigmatulin <andrei.nigmatu...@gmail.com>
wrote:
> You're talking about $HOME directory ? I believe it does matter only when you
> run external commands from php. They sometimes want to have access to
> dot-files in $HOME. In this case you should set up correct home directory
> with appropriate permissions.

No, I use the regular /var/www directory, on a dedicated server. The
http server is nginx.

Floren Munteanu

unread,
Mar 30, 2008, 8:07:45 PM3/30/08
to highload-php-en
On Mar 30, 6:30 pm, Andrei Nigmatulin <andrei.nigmatu...@gmail.com>
wrote:
> Setting the above only makes sense if you're
> - running linux
> - using unix socket between web server and php-fastcgi
> - need to restrict access to socket in file system from any processes other
> than web server.
> The 'owner', 'group' and 'mode' must be set in order to allow connect(2)'s
> from web server's process uid/gid.

I see, so I don't need to define it there. What about:
...
<value name="user">fcgipm</value>
<value name="group">fcgipm</value>
<value name="pm">
<value name="style">static</value>
<value name="max_children">5</value>
...

Right now, I use user fcgipm to logrotate the the logs. Every time I
build a RPM with a new user, I assign it a nologin + directory. For
example, for nginx I have:
---
%define userdir %{_localstatedir}/spool/nginx
...
%pre
%{_sbindir}/useradd -s /sbin/nologin -M -r -d %{userdir} \
-c "Web Server" nginx &>/dev/null || :
...

What -d should I set for fcgipm user? Thanks for guiding me on that
issue.

Andrei Nigmatulin

unread,
Mar 30, 2008, 8:27:45 PM3/30/08
to highloa...@googlegroups.com

It's up to you where to create user's home dir on your server. php-fpm itself
does not expect any specific path to be set. "/home/fcgipm" is just fine.

Floren Munteanu

unread,
Mar 30, 2008, 11:02:01 PM3/30/08
to highload-php-en
On Mar 30, 8:27 pm, Andrei Nigmatulin <andrei.nigmatu...@gmail.com>
wrote:
> It's up to you where to create user's home dir on your server. php-fpm itself
> does not expect any specific path to be set. "/home/fcgipm" is just fine.

Thanks for the clarification, Andrei. I wanted to make sure that php-
fpm does not expect any specific path to be set. Since this is a
system user account, I will give it /etc/fgcipm as home.

I really appreciate that you and Igor Sysoev take the time to write
such great software.
One more time, thank you for your great support. Looking forward to
use your patch in 5.2.6. :)
Reply all
Reply to author
Forward
0 new messages