Welcome! Log In Create A New Profile

Advanced

php-fpm is mixing configs of different vhosts.

Posted by bvidinli 
php-fpm is mixing configs of different vhosts.
March 05, 2013 03:08AM
The newest problem is: php-fpm is mixing configs of different vhosts.
let me explain,
I have a vhost section like:


server {
listen 80;
server_name sub1.something.com;
.....
fastcgi_param PHP_ADMIN_VALUE "open_basedir=somedir11";
}

and another section similar but different server_name:


server {ne
listen 80;
server_name sub2.something.com;
.....
fastcgi_param PHP_ADMIN_VALUE "open_basedir=somedir22";
}


the problem is this:
even the user goes to sub1.something.com, the open_basedir of second vhost
section (somedir22) is applied. It seems that, php or php-fpm or nginx or
whatever it is, remembering some previous state of PHP_ADMIN_VALUE.
what may be the problem ?
I also suspect this before, because I see logs in syslog, showing wrong
filenames.
for ex: php syslog(LOG_WARNING,"log from file1") generates a log in syslog,
syslog(LOG_WARNING,"log from file2")
I saw in past, logs are mixed somehow. wrong message is displayed with
wrong prefix (of syslog line).

Is there a setting that causes php-fpm (or anything) remembers some other
state ?
Any suggestion ?

--

---
You received this message because you are subscribed to the Google Groups "highload-php-en" group.
To unsubscribe from this group and stop receiving emails from it, send an email to highload-php-en+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
Jérôme Loyet
Re: php-fpm is mixing configs of different vhosts.
March 05, 2013 03:12AM
Hi

can you please provide your full php-fpm and nginx configuration file
please ? so as version and OS

thanks
++fat


2013/3/5 Bahattin Vidinli <bvidinli@gmail.com>

> The newest problem is: php-fpm is mixing configs of different vhosts.
> let me explain,
> I have a vhost section like:
>
>
> server {
> listen 80;
> server_name sub1.something.com;
> ....
> fastcgi_param PHP_ADMIN_VALUE "open_basedir=somedir11";
> }
>
> and another section similar but different server_name:
>
>
> server {ne
> listen 80;
> server_name sub2.something.com;
> ....
> fastcgi_param PHP_ADMIN_VALUE "open_basedir=somedir22";
> }
>
>
> the problem is this:
> even the user goes to sub1.something.com, the open_basedir of second
> vhost section (somedir22) is applied. It seems that, php or php-fpm or
> nginx or whatever it is, remembering some previous state of PHP_ADMIN_VALUE.
> what may be the problem ?
> I also suspect this before, because I see logs in syslog, showing wrong
> filenames.
> for ex: php syslog(LOG_WARNING,"log from file1") generates a log in syslog,
> syslog(LOG_WARNING,"log from file2")
> I saw in past, logs are mixed somehow. wrong message is displayed with
> wrong prefix (of syslog line).
>
> Is there a setting that causes php-fpm (or anything) remembers some other
> state ?
> Any suggestion ?
>
> --
>
> ---
> You received this message because you are subscribed to the Google Groups
> "highload-php-en" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to highload-php-en+unsubscribe@googlegroups.com.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>
>

--

---
You received this message because you are subscribed to the Google Groups "highload-php-en" group.
To unsubscribe from this group and stop receiving emails from it, send an email to highload-php-en+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
Re: php-fpm is mixing configs of different vhosts.
March 06, 2013 02:56PM
open_basedir should be set in php.ini and not be passed via nginx.

ea.

[PATH=/webroot/www.testsite123.nl]
open_basedir = /webroot/www.testsite123.nl
doc_root = /webroot/www.testsite123.nl
Re: php-fpm is mixing configs of different vhosts.
May 05, 2013 03:26PM
itpp2012 Wrote:
-------------------------------------------------------
> open_basedir should be set in php.ini and not be passed via nginx.
>
> ea.
>
> [PATH=/webroot/www.testsite123.nl]
> open_basedir = /webroot/www.testsite123.nl
> doc_root = /webroot/www.testsite123.nl

open_basedir can be passed via nginx without problem, bad advice.

To the original question: it should work. I suggest you to check whether other PHP configuration files like hosts.ini (per host or per path) or php-fpm.conf (per pool) already load 'open_basedir' admin value that cannot be altered later by nginx with PHP_ADMIN_VALUE. Check with phpinfo() call which files are being loaded and what is master and local value for 'open_basedir'. This will help you to track the issue.

Good luck!

Andrejs
Re: php-fpm is mixing configs of different vhosts.
May 07, 2013 02:49PM
locojohn Wrote:
-------------------------------------------------------
> itpp2012 Wrote:
> -------------------------------------------------------
> > open_basedir should be set in php.ini and not be passed via nginx.
> open_basedir can be passed via nginx without problem, bad advice.

In a hardened environment you always have limited, separated nginx and php processes, therefor when nginx gets hacked the back-end remains save from alteration via nginx (and the other way around), the advise stands when you care about hardening.
Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 113
Record Number of Users: 6 on February 13, 2018
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready