“She may not look like much, but she’s got it where it counts, kid. I’ve made a lot of special modifications myself.” —Han Solo on the Millenium Falcon’s fractal of bad design
Also: Python has no ‘switch’ statement.
Like many switching to the nginx/php-fpm combo, I ran into a situation with some PHP scripts that relied on $_SERVER[“HTTPS”] having a value of ‘on’. As of nginx 1.0.4, this isn’t provided out of the box. Of course, the rest of the $_SERVER[“SSL_*”] values that are present under Apache and mod_php (or php-fpm) aren’t available either.
The closest approximation I could come up with to Apache’s mod_ssl +StdEnvVars for nginx is this: create a file in your nginx config directory (commonly /usr/local/nginx/conf) called fastcgi_ssl.conf. Add the following to it:
# Provide as much of Apache's SSL +StdEnvVars data as possible.
fastcgi_param HTTPS on;
fastcgi_param SSL_PROTOCOL $ssl_protocol;
fastcgi_param SSL_CIPHER $ssl_cipher;
fastcgi_param SSL_SESSION_ID $ssl_session_id;
fastcgi_param SSL_CLIENT_VERIFY $ssl_client_verify;
# _SERVER entries for these will be empty unless you
# rely on client-side certs you've issued
#fastcgi_param SSL_CLIENT_CERT $ssl_client_cert;
#fastcgi_param SSL_CLIENT_RAW_CERT $ssl_client_raw_cert;
#fastcgi_param SSL_CLIENT_S_DN $ssl_client_s_dn;
#fastcgi_param SSL_CLIENT_I_DN $ssl_client_i_dn;
#fastcgi_param SSL_CLIENT_SERIAL $ssl_client_serial;
Include this file only inside server {} blocks that are configured for SSL use in nginx, and you’ll find that a environment checks for HTTPS work a lot better from within PHP.
I had a heck of a time getting PEAR2’s pyrus.phar 2.0.0a3 running. I downloaded pyrus.phar, ran ‘php pyrus.phar list-packages’ and got nothing.
Turns out the problem was having Suhosin installed as well. Once I added:
suhosin.executor.include.whitelist=”phar”
… to my php.ini directives, ‘php pyrus.phar list-packages’ gave me a list of packages.
I always forget this, but the trick is always remember: if it doesn’t work for some reason, check suhosin settings. Make sure you have suhosin logging turned on, and check the log!
Got something up on AWS CloudFront that’s not what it’s supposed to be? Use this quickie script to zap those mistakes. No external libraries required, no fancy and overly complex signature routines. Just a simple, quick script that’s not even worth a repo. Copy, paste, tweak, zap, and exhale.
Excessive use of this script may run up a tab at Amazon.
No additional charge for the first 1,000 files that you request for invalidation each month. $0.005 per file listed in your invalidation requests thereafter.
See CloudFront pricing for more details.