fastcgi_param PHP_ADMIN_VALUE

118 views
Skip to first unread message

Stageline

unread,
Jul 5, 2010, 5:21:47 PM7/5/10
to highload-php-en
Hello!

Does anybody have any idea how to activate the option open_basedir /
domain?

This:

location ~ \.php$
{
...
fastcgi_param PHP_ADMIN_VALUE "open_basedir=/usr/local/www/data/
domain.hu/";
}

not work for me.

nginx version: nginx/0.7.67
PHP 5.3.2 with Suhosin-Patch (cli) (built: Jun 4 2010 15:42:40)
Copyright (c) 1997-2009 The PHP Group
Zend Engine v2.3.0, Copyright (c) 1998-2010 Zend Technologies

Jérôme Loyet

unread,
Jul 5, 2010, 5:59:07 PM7/5/10
to highloa...@googlegroups.com
2010/7/5 Stageline <stag...@gmail.com>:

> Hello!
>
> Does anybody have any idea how to activate the option open_basedir /
> domain?
>
> This:
>
> location ~ \.php$
> {
>     ...
>     fastcgi_param PHP_ADMIN_VALUE "open_basedir=/usr/local/www/data/
> domain.hu/";
> }
>
> not work for me.

See http://bugs.php.net/bug.php?id=51595 for examples.

I can see you're using suhosin. Can you try to set another PHP value like:

fastcgi_param PHP_ADMIN_VALUE "pcre.backtrack_limit=424242";

open_basedir is a special case. If you can try without suhosin it
would be great also.

Thx
++ jerome

Illó Gábor

unread,
Jul 6, 2010, 3:46:52 AM7/6/10
to highloa...@googlegroups.com
2010/7/5 Jérôme Loyet <m...@fatbsd.com>

Still not work without suhosin patch

PHP 5.3.2 (cli) (built: Jul  6 2010 09:18:22)
Copyright (c) 1997-2010 The PHP Group

Zend Engine v2.3.0, Copyright (c) 1998-2010 Zend Technologies

        location ~ \.php$
        {
            fastcgi_pass 127.0.0.1:9000;
            fastcgi_index index.php;
            fastcgi_param SCRIPT_FILENAME /usr/local/www/data/mouseoleum.hu$fastcgi_script_name;
            fastcgi_param PHP_ADMIN_VALUE "cgi.fix_pathinfo=0";
            include fastcgi_params;
        }

[cgi.fix_pathinfo] => Array
(
         [global_value] => 1
         [local_value] => 1
         [access] => 4
)


Antony Dovgal

unread,
Jul 6, 2010, 3:52:57 AM7/6/10
to highloa...@googlegroups.com
On 07/06/2010 11:46 AM, Illó Gábor wrote:
> location ~ \.php$
> {
> fastcgi_pass 127.0.0.1:9000 <http://127.0.0.1:9000>;

> fastcgi_index index.php;
> fastcgi_param SCRIPT_FILENAME
> /usr/local/www/data/mouseoleum.hu
> <http://mouseoleum.hu>$fastcgi_script_name;

> fastcgi_param PHP_ADMIN_VALUE "cgi.fix_pathinfo=0";
> include fastcgi_params;
> }

You're declaring _environment variable_ called "PHP_ADMIN_VALUE", no wonder it doesn't work.

Use FPM config for that:
php_admin_value[open_basedir] = ...

for old-style XML config you can do this:
<value name="php_defines">
<value name="open_basedir">...</value>
</value>
--
Wbr,
Antony Dovgal
---
http://pinba.org - realtime statistics for PHP

Jérôme Loyet

unread,
Jul 6, 2010, 3:56:47 AM7/6/10
to highloa...@googlegroups.com
2010/7/6 Illó Gábor <stag...@gmail.com>:

> 2010/7/5 Jérôme Loyet <m...@fatbsd.com>
>>
>> 2010/7/5 Stageline <stag...@gmail.com>:
>> > Hello!
>> >
>> > Does anybody have any idea how to activate the option open_basedir /
>> > domain?
>> >
>> > This:
>> >
>> > location ~ \.php$
>> > {
>> >     ...
>> >     fastcgi_param PHP_ADMIN_VALUE "open_basedir=/usr/local/www/data/
>> > domain.hu/";
>> > }
>> >
>> > not work for me.
>>
>> See http://bugs.php.net/bug.php?id=51595 for examples.
>>
>> I can see you're using suhosin. Can you try to set another PHP value like:
>>
>> fastcgi_param PHP_ADMIN_VALUE "pcre.backtrack_limit=424242";
>>
>> open_basedir is a special case. If you can try without suhosin it
>> would be great also.
>>
>> Thx
>> ++ jerome
>>
>> >
>> > nginx version: nginx/0.7.67
>> > PHP 5.3.2 with Suhosin-Patch (cli) (built: Jun  4 2010 15:42:40)
>> > Copyright (c) 1997-2009 The PHP Group
>> > Zend Engine v2.3.0, Copyright (c) 1998-2010 Zend Technologies
>> >
>
> Still not work without suhosin patch

how did you compile 5.3.2 with FPM support ? Which SVN revision did you use ?

Illó Gábor

unread,
Jul 6, 2010, 4:10:41 AM7/6/10
to highloa...@googlegroups.com
2010/7/6 Jérôme Loyet <m...@fatbsd.com>
Oh. I don't use php-fpm, i use spawn-fcgi, because freebsd fpm port not available for php 5.3.2!

--
Best Regards
Gábor Illó

Jérôme Loyet

unread,
Jul 6, 2010, 4:14:42 AM7/6/10
to highloa...@googlegroups.com
2010/7/6 Illó Gábor <stag...@gmail.com>:

so that's normal behaviour. This feature is only available on FPM.

GM

unread,
Jul 6, 2010, 11:26:12 AM7/6/10
to highload-php-en
Using fastcgi you can do something similar to this: /usr/bin/spawn-
fcgi -a 127.0.0.1 -p 9001 -u someuser -g somegroup -- /usr/bin/php5-
cgi -d open_basedir=/path/to/directory

On Jul 6, 11:14 am, Jérôme Loyet <m...@fatbsd.com> wrote:
> 2010/7/6 Illó Gábor <stagel...@gmail.com>:
>
>
>
>
>
> > 2010/7/6 Jérôme Loyet <m...@fatbsd.com>
>
> >> 2010/7/6 Illó Gábor <stagel...@gmail.com>:
> >> > 2010/7/5 Jérôme Loyet <m...@fatbsd.com>
>
> >> >> 2010/7/5 Stageline <stagel...@gmail.com>:
> >> >> > Hello!
>
> >> >> > Does anybody have any idea how to activate the option open_basedir /
> >> >> > domain?
>
> >> >> > This:
>
> >> >> > location ~ \.php$
> >> >> > {
> >> >> >     ...
> >> >> >     fastcgi_param PHP_ADMIN_VALUE "open_basedir=/usr/local/www/data/
> >> >> > domain.hu/";
> >> >> > }
>
> >> >> > not work for me.
>
> >> >> Seehttp://bugs.php.net/bug.php?id=51595for examples.

Illó Gábor

unread,
Jul 8, 2010, 5:35:11 AM7/8/10
to highloa...@googlegroups.com
This example is use Fix directory. I hosted many site, so i think is don't solve my problem.

2010/7/6 GM <g...@gm.lv>

GM

unread,
Jul 9, 2010, 7:12:32 AM7/9/10
to highload-php-en
Then php-fpm wont solve them either, because it is the same thing. I
mean you will have to create new instance for every basedir wou want.
> > > >> >> > Copyright (c)1997-2009The PHP Group
> > > >> >> > Zend Engine v2.3.0, Copyright (c)1998-2010Zend Technologies
>
> > > >> > Still not work without suhosin patch
>
> > > >> how did you compile 5.3.2 with FPM support ? Which SVN revision did
> > you
> > > >> use ?
>
> > > >> > PHP 5.3.2 (cli) (built: Jul  6 2010 09:18:22)
> > > >> > Copyright (c)1997-2010The PHP Group
> > > >> > Zend Engine v2.3.0, Copyright (c)1998-2010Zend Technologies

Antony Dovgal

unread,
Jul 9, 2010, 7:16:58 AM7/9/10
to highloa...@googlegroups.com
On 07/09/2010 03:12 PM, GM wrote:
> Then php-fpm wont solve them either, because it is the same thing. I
> mean you will have to create new instance for every basedir wou want.

FPM does solve it, because you can create several FPM pools running under different
configuration and serving different web-sites.

grigori

unread,
Jul 10, 2010, 7:23:37 AM7/10/10
to highload-php-en
I would try /etc/php.d/site.conf files autoincluded in php.ini
and have a section
[HOST=site.com]
open_basedir = /home/site.com/http_root
in them

GM

unread,
Jul 10, 2010, 7:30:30 AM7/10/10
to highload-php-en
I guess you can do the same using fastcgi aproach. Just run more than
one instance with different settings and on different port. I like to
use fpm because of nice configuration and better proccessing, but in
general you can do the same with fastcgi as fpm.

One thing I haven't discovered yet is it possible to restart one
specific pool not all of them.

infotechproximity8

unread,
Jul 13, 2010, 8:31:35 AM7/13/10
to highloa...@googlegroups.com
>> how did you compile 5.3.2 with FPM support ? Which SVN revision did
you
>> use ?
>>
>> >
>> > PHP 5.3.2 (cli) (built: Jul 6 2010 09:18:22)
>> > Copyright (c) 1997-2010 The PHP Group

>> > Zend Engine v2.3.0, Copyright (c) 1998-2010 Zend Technologies
>> >
>> > location ~ \.php$
>> > {
>> > fastcgi_pass 127.0.0.1:9000;

>> > fastcgi_index index.php;
>> > fastcgi_param SCRIPT_FILENAME
>> > /usr/local/www/data/mouseoleum.hu$fastcgi_script_name;
>> > fastcgi_param PHP_ADMIN_VALUE "cgi.fix_pathinfo=0";
_____________________________________________________________________________

[url=http://www.stow-group.com/EN/products/palletised-goods/conventional-pallet-racking-2511.aspx]
Pallet Racking[/url] |
[url=http://www.shoe-envy.co.uk/Fitflop_Boots]Fitflop Boots[/url]

Posted at Nginx Forum: http://forum.nginx.org/read.php?3,105656,108198#msg-108198

Illó Gábor

unread,
Jul 13, 2010, 8:43:14 AM7/13/10
to highloa...@googlegroups.com
Oh. I don't use php-fpm, i use spawn-fcgi, because freebsd fpm port not available for php 5.3.2!

2010/7/13 infotechproximity8 <nginx...@nginx.us>
Reply all
Reply to author
Forward
0 new messages