Welcome! Log In Create A New Profile

Advanced

PHP-FPM dynamic variable environment unknow

Posted by Élodie BOSSIER 
Élodie BOSSIER
PHP-FPM dynamic variable environment unknow
October 28, 2013 01:58AM
Greetings,

I have installed the latest version of PHP-FPM, Apache and mod_fastcgi.

All is working, except the ENV arn't GLOBAL.
I can get the IP of the visitor with $_SERVER['REMOTE_ADDR'] from a script
PHP, but i can't use this information from my mail wrapper sendmail.pl
wrote in Perl.

Before to use PHP-FPM / FastCGI, i had suphp and all were correct, even
inside my wrapper sendmail.pl in Perl.

When i check my phpinfo(), "Environment" is mostly empty, i have only USER
and HOME.

I know i can fill this part with php-fpm.conf with this :
env[MY_ENV_VAR_1] = 'value1'

and it's working, this variable is global. But how can i set REMOTE_ADDR
which is a dynamic value with the visitor ?

I have tried this :
env[REMOTE_ADDR] = $REMOTE_ADDR

but the variable $REMOTE_ADDR is empty, even if $_SERVER["REMOTE_ADDR"] is
still here, but not in GLOBAL.

I have tried this :
env[REMOTE_ADDR] = $_SERVER["REMOTE_ADDR"]

And $REMOTE_ADDR is still empty.

I have tried again this :
env[REMOTE_ADDR] = $_SERVER["REMOTE-ADDR"]

And $REMOTE_ADDR is always empty, even if $_SERVER["REMOTE_ADDR"] is still
here.

Do you have an idea please ?

--

---
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.
Antony Dovgal
Re: PHP-FPM dynamic variable environment unknow
October 28, 2013 10:02AM
On 2013-10-27 23:52, Élodie BOSSIER wrote:
> Greetings,
>
> I have installed the latest version of PHP-FPM, Apache and mod_fastcgi.
>
> All is working, except the ENV arn't GLOBAL.
> I can get the IP of the visitor with $_SERVER['REMOTE_ADDR'] from a script PHP, but i can't use this information from my mail wrapper sendmail.pl wrote in Perl.
>
> Before to use PHP-FPM / FastCGI, i had suphp and all were correct, even inside my wrapper sendmail.pl in Perl.

Pass it as a parameter to this script.
Or how do you run it?

--
Wbr,
Antony Dovgal
---
http://pinba.org - realtime profiling for PHP

--

---
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.
Élodie BOSSIER
Re: PHP-FPM dynamic variable environment unknow
October 28, 2013 03:42PM
Le lundi 28 octobre 2013 15:01:19 UTC+1, Antony Dovgal a écrit :
>
>
> Pass it as a parameter to this script.
> Or how do you run it?
>

Thanks so much for your interest.

I lunch my wrapper with php.ini :

; For Unix only. You may supply arguments as well (default: "sendmail -t
-i").
; http://php.net/sendmail-path
sendmail_path = /usr/bin/sendmail.pl -t -i

--

---
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.
Antony Dovgal
Re: PHP-FPM dynamic variable environment unknow
October 29, 2013 06:20AM
On 2013-10-28 23:41, Élodie BOSSIER wrote:
> Le lundi 28 octobre 2013 15:01:19 UTC+1, Antony Dovgal a écrit :
>
>
> Pass it as a parameter to this script.
> Or how do you run it?
>
>
> Thanks so much for your interest.
>
> I lunch my wrapper with php.ini :
>
> ; For Unix only. You may supply arguments as well (default: "sendmail -t -i").
> ; http://php.net/sendmail-path
> sendmail_path = /usr/bin/sendmail.pl -t -i

In that case you'll have to use putenv() to set all the proper env variables before calling mail().
See http://php.net/putenv

--
Wbr,
Antony Dovgal
---
http://pinba.org - realtime profiling for PHP

--

---
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.
Élodie BOSSIER
Re: PHP-FPM dynamic variable environment unknow
October 30, 2013 03:40PM
Thanks so much for your response.
I have did this and now it's ok, not perfect but it's a good solution.

I have added into my sendmail.pl wrapper a construct DBI for my queries to
avoid SQL injection if the owner of the website redefine the env variables
before to send an amail.

Thanks so much again,
Best regards.

--

---
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.
Sorry, only registered users may post in this forum.

Click here to login

Online Users

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