Comments (5)
Nevermind .. it seems that at least in my php .. it's not done like this
d3xt3r01 tmp # php -v
PHP 5.5.6-pl0-gentoo (cli) (built: Dec 2 2013 01:18:37)
Copyright (c) 1997-2013 The PHP Group
Zend Engine v2.5.0, Copyright (c) 1998-2013 Zend Technologies
with Zend OPcache v7.0.3-dev, Copyright (c) 1999-2013, by Zend Technologies
Piece of code that does seem to do the job:
$env = array("AUTHTYPE", "CONTEXT", "IP", "HOST", "PATH", "COOKIE",
"HTTP_HOST", "URI");
foreach($env as $v){
flog($v.'='.getenv($v));
}
Results:
2013-12-12 19:42:00 - SELECT `id`, `expiry` FROM `auth` WHERE `user` = 'dex'
AND `password` = '...' AND `enabled` = '1' AND (`expiry` > NOW() OR `expiry` =
'0000-00-00 00:00:00') LIMIT 1;
2013-12-12 19:42:00 - Yes
2013-12-12 19:42:00 - dex - ...
2013-12-12 19:42:00 - AUTHTYPE=PASS
2013-12-12 19:42:00 - CONTEXT=
2013-12-12 19:42:00 - IP=192.168.1.1
2013-12-12 19:42:00 - HOST=
2013-12-12 19:42:00 -
PATH=/bin:/sbin:/bin:/sbin:/usr/bin:/usr/sbin:/usr/bin:/usr/sbin:/usr/local/bin:
/usr/local/sbin:/opt/bin:/usr/x86_64-pc-linux-gnu/gcc-bin/4.7.3:/opt/nvidia-cg-t
oolkit/bin:/opt/cuda/bin
2013-12-12 19:42:00 - COOKIE=
2013-12-12 19:42:00 - HTTP_HOST=d3x...
2013-12-12 19:42:00 - URI=/some/index.php
Hope this saves some time .. maybe it can be modified in the example
Original comment by [email protected]
on 12 Dec 2013 at 5:45
from mod-auth-external.
A cleaner way:
$env = array("AUTHTYPE", "CONTEXT", "IP", "HOST", "PATH", "COOKIE",
"HTTP_HOST", "URI");
foreach($env as $k){
$v = getenv($v);
if(empty($v)){ continue; }
flog($k.'='.$v);
}
Also, one could do it like this:
ob_start();
phpinfo(INFO_ENVIRONMENT);
$phpinfo = ob_get_contents();
ob_get_clean();
flog($phpinfo);
Original comment by [email protected]
on 12 Dec 2013 at 5:52
from mod-auth-external.
[deleted comment]
from mod-auth-external.
Hmmm...I can confirm that the test.pipe.php script in the distribution fails to
print any environment variables on my computer either.
That was a contributed script. I didn't write it, and I don't know PHP at all.
My minimal web research suggests that the original version is kind of supposed
to work. And there ought to be a way to print out everything in the
environment, not just stuff from a list of names (we add environment variables
fairly often - I don't want to have to remember to update this script the next
time that happens). Your last version might do that, but it seems rather weird.
If we are doing sample programs, they ought to be good, generalizable samples.
I could use some input from other actual PHP programmers on the right solution
to this problem.
Original comment by [email protected]
on 15 Jan 2014 at 2:50
- Changed state: Accepted
from mod-auth-external.
It looks like the original code will work if and only if the "variables_order"
string defined in your "php.ini" file includes an "E" in it's value. On my
system it is set to
variables_order = "GPCS"
The "php.ini" file also says:
; This directive determines which super global arrays are registered when PHP
; starts up. If the register_globals directive is enabled, it also determines
; what order variables are populated into the global space. G,P,C,E & S are
; abbreviations for the following respective super globals: GET, POST, COOKIE,
; ENV and SERVER. There is a performance penalty paid for the registration of
; these arrays and because ENV is not as commonly used as the others, ENV is
; is not recommended on productions servers. You can still get access to
; the environment variables through getenv() should you need to.
So probably we should default to one of the getenv() solutions.
Original comment by [email protected]
on 15 Jan 2014 at 3:03
from mod-auth-external.
Related Issues (20)
- checkpassword method appears to be broken in 3.2.x version HOT 5
- Internal Server Error when using SSL Virtual Host HOT 2
- Group Authentication not passing 'GROUP' env or argv variables HOT 4
- Modification to allow an loadbalancer between browser and server HOT 4
- Modification to allow an loadbalancer between browser and server HOT 1
- 1 minute wait before auth HOT 9
- Mod-auth-external Needs a New Maintainer HOT 1
- passing data as base64 to prevent injection HOT 2
- PAM ENV variables for auth script
- Environment to include REQUEST_METHOD - feature request HOT 1
- Excellent documentation! HOT 1
- Is mod_authnz_external thread-safe?
- Failure stops other authenticators HOT 1
- Makefile has install for default target should be build HOT 1
- Patch for /trunk/mod_authnz_external/mysql/mysql-auth.pl HOT 1
- Cant compile source (mod-auth-external) HOT 3
- Use on Windows with Apache 2.2 HOT 1
- [Patch] conn_rec->remote_ip compilation failure with Apache 2.4.1 HOT 3
- authnz_external_module and pwauth on CentOS 6.2 failure HOT 6
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from mod-auth-external.