acquia / acquia-sdk-php

The Acquia SDK for PHP allows developers to build applications on top of Acquia services.
MIT License
25 stars 20 forks source link

Swap out calls to getenv() for $_ENV #58

Closed jacobbednarz closed 10 years ago

jacobbednarz commented 10 years ago

This fixes the issues with PHP's getenv() not being able to fetch the correct hosting environment variables on Acquia.

jacobbednarz commented 10 years ago

...and of course it breaks the build :sweat:

cpliakas commented 10 years ago

Looking at the code, it might be helpful to add a getenv method to the CloudEnvironmentTest that mimics the PHP function. That way we can test if the array key exists or not in order to avoid errors that will break the build.

Thanks for your contribution and continued work on this issue.

jacobbednarz commented 10 years ago

Looking at the code, it might be helpful to add a getenv method to the CloudEnvironmentTest that mimics the PHP function

Would you be happy with something like this?

$environment = (!empty($_ENV['AH_SITE_ENVIRONMENT'])) ?: getenv('AH_SITE_ENVIRONMENT');
$this->setEnvironment($environment);
cpliakas commented 10 years ago

Personally I would rather go all-in with one solution, e.g. $_ENV over getenv() and not mix the two.

Maybe something like $environment = isset($_ENV['AH_SITE_ENVIRONMENT']) ? $_ENV['AH_SITE_ENVIRONMENT'] : false;

Unfortunately we cannot use short-hand ternary with empty() otherwise $environment will evaluate to true and not the value of $_ENV['AH_SITE_ENVIRONMENT'].

scor commented 10 years ago

FWIW, Drush, Drupal core and Symfony all use getenv(). The only places I was able to find $_ENV was in isolated cases in some tests... So it might be wiser to understand the underlying issue before making such change from a popular method to our own.

webbj74 commented 10 years ago

Separate from the Travis-CI env config issue, it might be useful to see the output of phpinfo() called in the same context that getenv('AH_SITE_ENVIRONMENT') appears to fail. This might help us understand the underlying issue.

@jacobbednarz could you post a pastebin link to the output in your situation? As you're probably aware, phpinfo may output some info you consider sensitive, so scrub/occult as needed.

jacobbednarz commented 10 years ago

FWIW, Drush, Drupal core and Symfony all use getenv(). The only places I was able to find $_ENV was in isolated cases in some tests... So it might be wiser to understand the underlying issue before making such change from a popular method to our own.

I would definitely like to know the difference (even if it is just for my reference) however I wouldn't like it to hold up this pull request. Should there be a valid reason to only use getenv() we can always swap it to use it.

Personally I would rather go all-in with one solution, e.g. $_ENV over getenv() and not mix the two.

Sure! Will add it in.

Unfortunately we cannot use short-hand ternary with empty() otherwise $environment will evaluate to true and not the value of $_ENV['AH_SITE_ENVIRONMENT'].

Doh, missed this one in my initial tests. :p

@jacobbednarz could you post a pastebin link to the output in your situation? As you're probably aware, phpinfo may output some info you consider sensitive, so scrub/occult as needed.

phpinfo() output below. If you want the actual account details to look on the box yourself, feel free to drop me a message and I can send you the actual hostnames.

PHP Version => 5.3.2-1ubuntu4.22

System => Linux [REDACTED] 2.6.32-351-ec2 #63-Ubuntu SMP Mon Mar 25 15:35:09 UTC 2013 x86_64
Build Date => Dec 12 2013 04:15:39
Server API => Command Line Interface
Virtual Directory Support => disabled
Configuration File (php.ini) Path => /etc/php5/cli
Loaded Configuration File => /etc/php5/cli/php.ini
Scan this dir for additional .ini files => /etc/php5/cli/conf.d
Additional .ini files parsed => /etc/php5/cli/conf.d/curl.ini,
/etc/php5/cli/conf.d/gd.ini,
/etc/php5/cli/conf.d/gmp.ini,
/etc/php5/cli/conf.d/imagick.ini,
/etc/php5/cli/conf.d/imap.ini,
/etc/php5/cli/conf.d/ldap.ini,
/etc/php5/cli/conf.d/mcrypt.ini,
/etc/php5/cli/conf.d/memcache.ini,
/etc/php5/cli/conf.d/memcached.ini,
/etc/php5/cli/conf.d/mongo.ini,
/etc/php5/cli/conf.d/mssql.ini,
/etc/php5/cli/conf.d/mysql.ini,
/etc/php5/cli/conf.d/mysqli.ini,
/etc/php5/cli/conf.d/pdo.ini,
/etc/php5/cli/conf.d/pdo_dblib.ini,
/etc/php5/cli/conf.d/pdo_mysql.ini,
/etc/php5/cli/conf.d/pdo_pgsql.ini,
/etc/php5/cli/conf.d/pdo_sqlite.ini,
/etc/php5/cli/conf.d/pgsql.ini,
/etc/php5/cli/conf.d/sqlite.ini,
/etc/php5/cli/conf.d/sqlite3.ini,
/etc/php5/cli/conf.d/tidy.ini,
/etc/php5/cli/conf.d/uploadprogress.ini,
/etc/php5/cli/conf.d/xdebug_settings.ini,
/etc/php5/cli/conf.d/xhprof.ini,
/etc/php5/cli/conf.d/xmlrpc.ini,
/etc/php5/cli/conf.d/xsl.ini

PHP API => 20090626
PHP Extension => 20090626
Zend Extension => 220090626
Zend Extension Build => API220090626,NTS
PHP Extension Build => API20090626,NTS
Debug Build => no
Thread Safety => disabled
Zend Memory Manager => enabled
Zend Multibyte Support => disabled
IPv6 Support => enabled
Registered PHP Streams => ftps, compress.zlib, compress.bzip2, php, file, glob, data, ftp, phar, zip, global, http, https, feed, public, temporary
Registered Stream Socket Transports => tcp, udp, unix, udg, ssl, sslv3, sslv2, tls
Registered Stream Filters => zlib.*, bzip2.*, convert.iconv.*, string.rot13, string.toupper, string.tolower, string.strip_tags, convert.*, consumed, dechunk

This server is protected with the Suhosin Patch 0.9.9.1
Copyright (c) 2006-2007 Hardened-PHP Project
Copyright (c) 2007-2009 SektionEins GmbH

This program makes use of the Zend Scripting Language Engine:
Zend Engine v2.3.0, Copyright (c) 1998-2010 Zend Technologies

 _______________________________________________________________________

Configuration

bcmath

BCMath support => enabled

Directive => Local Value => Master Value
bcmath.scale => 0 => 0

bz2

BZip2 Support => Enabled
Stream Wrapper support => compress.bz2://
Stream Filter support => bzip2.decompress, bzip2.compress
BZip2 Version => 1.0.5, 10-Dec-2007

calendar

Calendar support => enabled

Core

PHP Version => 5.3.2-1ubuntu4.22

Directive => Local Value => Master Value
allow_call_time_pass_reference => Off => Off
allow_url_fopen => On => On
allow_url_include => Off => Off
always_populate_raw_post_data => Off => Off
arg_separator.input => & => &
arg_separator.output => & => &
asp_tags => Off => Off
auto_append_file => no value => no value
auto_globals_jit => On => On
auto_prepend_file => no value => no value
browscap => no value => no value
default_charset => no value => no value
default_mimetype => text/html => text/html
define_syslog_variables => Off => Off
disable_classes => no value => no value
disable_functions => no value => no value
display_errors => STDOUT => STDOUT
display_startup_errors => Off => Off
doc_root => no value => no value
docref_ext => no value => no value
docref_root => no value => no value
enable_dl => On => On
error_append_string => no value => no value
error_log => syslog => syslog
error_prepend_string => no value => no value
error_reporting => 30719 => 30719
exit_on_timeout => Off => Off
expose_php => Off => Off
extension_dir => /usr/lib/php5/20090626 => /usr/lib/php5/20090626
file_uploads => On => On
highlight.bg => <font style="color: #FFFFFF">#FFFFFF</font> => <font style="color: #FFFFFF">#FFFFFF</font>
highlight.comment => <font style="color: #FF8000">#FF8000</font> => <font style="color: #FF8000">#FF8000</font>
highlight.default => <font style="color: #0000BB">#0000BB</font> => <font style="color: #0000BB">#0000BB</font>
highlight.html => <font style="color: #000000">#000000</font> => <font style="color: #000000">#000000</font>
highlight.keyword => <font style="color: #007700">#007700</font> => <font style="color: #007700">#007700</font>
highlight.string => <font style="color: #DD0000">#DD0000</font> => <font style="color: #DD0000">#DD0000</font>
html_errors => Off => Off
ignore_repeated_errors => On => On
ignore_repeated_source => Off => Off
ignore_user_abort => Off => Off
implicit_flush => On => On
include_path => .:/usr/share/php:/usr/share/pear => .:/usr/share/php:/usr/share/pear
log_errors => On => On
log_errors_max_len => 1024 => 1024
magic_quotes_gpc => Off => Off
magic_quotes_runtime => Off => Off
magic_quotes_sybase => Off => Off
mail.add_x_header => Off => Off
mail.force_extra_parameters => no value => no value
mail.log => no value => no value
max_execution_time => 0 => 0
max_file_uploads => 20 => 20
max_input_nesting_level => 64 => 64
max_input_time => -1 => -1
max_input_vars => 1000 => 1000
memory_limit => 512M => 512M
open_basedir => no value => no value
output_buffering => 0 => 0
output_handler => no value => no value
post_max_size => 256M => 256M
precision => 14 => 14
realpath_cache_size => 900K => 900K
realpath_cache_ttl => 300 => 300
register_argc_argv => On => On
register_globals => Off => Off
register_long_arrays => Off => Off
report_memleaks => On => On
report_zend_debug => Off => Off
request_order => no value => no value
safe_mode => Off => Off
safe_mode_exec_dir => no value => no value
safe_mode_gid => Off => Off
safe_mode_include_dir => no value => no value
sendmail_from => no value => no value
sendmail_path => /usr/sbin/sendmail -t -i => /usr/sbin/sendmail -t -i
serialize_precision => 17 => 17
short_open_tag => On => On
SMTP => localhost => localhost
smtp_port => 25 => 25
sql.safe_mode => Off => Off
track_errors => Off => Off
unserialize_callback_func => no value => no value
upload_max_filesize => 256M => 256M
upload_tmp_dir => no value => no value
user_dir => no value => no value
user_ini.cache_ttl => 300 => 300
user_ini.filename => .user.ini => .user.ini
variables_order => EGPCS => EGPCS
xmlrpc_error_number => 0 => 0
xmlrpc_errors => Off => Off
y2k_compliance => On => On
zend.enable_gc => On => On

ctype

ctype functions => enabled

curl

cURL support => enabled
cURL Information => 7.19.7
Age => 3
Features
AsynchDNS => No
Debug => No
GSS-Negotiate => Yes
IDN => Yes
IPv6 => Yes
Largefile => Yes
NTLM => Yes
SPNEGO => No
SSL => Yes
SSPI => No
krb4 => No
libz => Yes
CharConv => No
Protocols => tftp, ftp, telnet, dict, ldap, ldaps, http, file, https, ftps
Host => x86_64-pc-linux-gnu
SSL Version => OpenSSL/0.9.8k
ZLib Version => 1.2.3.3

date

date/time support => enabled
"Olson" Timezone Database Version => 0.system
Timezone Database => internal
Default timezone => Australia/Brisbane

Directive => Local Value => Master Value
date.default_latitude => 31.7667 => 31.7667
date.default_longitude => 35.2333 => 35.2333
date.sunrise_zenith => 90.583333 => 90.583333
date.sunset_zenith => 90.583333 => 90.583333
date.timezone => UTC => UTC

dba

DBA support => enabled
Supported handlers => cdb cdb_make db4 inifile flatfile

Directive => Local Value => Master Value
dba.default_handler => flatfile => flatfile

dom

DOM/XML => enabled
DOM/XML API Version => 20031129
libxml Version => 2.7.6
HTML Support => enabled
XPath Support => enabled
XPointer Support => enabled
Schema Support => enabled
RelaxNG Support => enabled

ereg

Regex Library => Bundled library enabled

exif

EXIF Support => enabled
EXIF Version => 1.4 $Id: exif.c 293036 2010-01-03 09:23:27Z sebastian $
Supported EXIF Version => 0220
Supported filetypes => JPEG,TIFF

Directive => Local Value => Master Value
exif.decode_jis_intel => JIS => JIS
exif.decode_jis_motorola => JIS => JIS
exif.decode_unicode_intel => UCS-2LE => UCS-2LE
exif.decode_unicode_motorola => UCS-2BE => UCS-2BE
exif.encode_jis => no value => no value
exif.encode_unicode => ISO-8859-15 => ISO-8859-15

fileinfo

fileinfo support => enabled
version => 1.0.5-dev

filter

Input Validation and Filtering => enabled
Revision => $Revision: 294106 $

Directive => Local Value => Master Value
filter.default => unsafe_raw => unsafe_raw
filter.default_flags => no value => no value

ftp

FTP support => enabled

gd

GD Support => enabled
GD Version => bundled (2.0.34 compatible)
FreeType Support => enabled
FreeType Linkage => with freetype
FreeType Version => 2.3.11
T1Lib Support => enabled
GIF Read Support => enabled
GIF Create Support => enabled
JPEG Support => enabled
libJPEG Version => 6b
PNG Support => enabled
libPNG Version => 1.2.42
WBMP Support => enabled
XPM Support => enabled
XBM Support => enabled

Directive => Local Value => Master Value
gd.jpeg_ignore_warning => 0 => 0

gettext

GetText Support => enabled

gmp

gmp support => enabled
GMP version => 4.3.2

hash

hash support => enabled
Hashing Engines => md2 md4 md5 sha1 sha224 sha256 sha384 sha512 ripemd128 ripemd160 ripemd256 ripemd320 whirlpool tiger128,3 tiger160,3 tiger192,3 tiger128,4 tiger160,4 tiger192,4 snefru snefru256 gost adler32 crc32 crc32b salsa10 salsa20 haval128,3 haval160,3 haval192,3 haval224,3 haval256,3 haval128,4 haval160,4 haval192,4 haval224,4 haval256,4 haval128,5 haval160,5 haval192,5 haval224,5 haval256,5

iconv

iconv support => enabled
iconv implementation => glibc
iconv library version => 2.11.1

Directive => Local Value => Master Value
iconv.input_encoding => ISO-8859-1 => ISO-8859-1
iconv.internal_encoding => ISO-8859-1 => ISO-8859-1
iconv.output_encoding => ISO-8859-1 => ISO-8859-1

imagick

imagick module => enabled
imagick module version => 2.1.1-rc1
imagick classes => Imagick, ImagickDraw, ImagickPixel, ImagickPixelIterator
ImageMagick version => ImageMagick 6.5.7-8 2012-08-17 Q16 http://www.imagemagick.org
ImageMagick copyright => Copyright (C) 1999-2009 ImageMagick Studio LLC
ImageMagick release date => 2012-08-17
ImageMagick Number of supported formats:  => 194
ImageMagick Supported formats => 3FR, A, AI, ART, ARW, AVI, AVS, B, BGR, BMP, BMP2, BMP3, BRF, BRG, C, CAL, CALS, CAPTION, CIN, CIP, CLIP, CMYK, CMYKA, CR2, CRW, CUR, CUT, DCM, DCR, DCX, DDS, DFONT, DNG, DPX, EPDF, EPI, EPS, EPS2, EPS3, EPSF, EPSI, EPT, EPT2, EPT3, ERF, FAX, FITS, FRACTAL, FTS, G, G3, GBR, GIF, GIF87, GRADIENT, GRAY, GRB, GROUP4, HALD, HISTOGRAM, HRZ, HTM, HTML, ICB, ICO, ICON, INFO, INLINE, IPL, ISOBRL, JNG, JP2, JPC, JPEG, JPG, JPX, K, K25, KDC, LABEL, M, M2V, M4V, MAP, MAT, MATTE, MIFF, MNG, MONO, MOV, MP4, MPC, MPEG, MPG, MRW, MSL, MTV, MVG, NEF, NULL, O, ORF, OTB, OTF, PAL, PALM, PAM, PATTERN, PBM, PCD, PCDS, PCL, PCT, PCX, PDB, PDF, PDFA, PEF, PFA, PFB, PFM, PGM, PGX, PICON, PICT, PIX, PJPEG, PLASMA, PNG, PNG24, PNG32, PNG8, PNM, PPM, PREVIEW, PS, PS2, PS3, PSD, PTIF, PWP, R, RADIAL-GRADIENT, RAF, RAS, RBG, RGB, RGBA, RGBO, RLA, RLE, SCR, SCT, SFW, SGI, SHTML, SR2, SRF, STEGANO, SUN, TEXT, TGA, THUMBNAIL, TIFF, TIFF64, TILE, TIM, TTC, TTF, TXT, UBRL, UIL, UYVY, VDA, VICAR, VID, VIFF, VST, WBMP, WMV, WPG, X, X3F, XBM, XC, XCF, XPM, XPS, XV, XWD, Y, YCbCr, YCbCrA, YUV

Directive => Local Value => Master Value
imagick.locale_fix => 0 => 0

imap

IMAP c-Client Version => 2007e
SSL Support => enabled
Kerberos Support => enabled

json

json support => enabled
json version => 1.2.1

ldap

LDAP Support => enabled
RCS Version => $Id: ldap.c 293036 2010-01-03 09:23:27Z sebastian $
Total Links => 0/unlimited
API Version => 3001
Vendor Name => OpenLDAP
Vendor Version => 20421
SASL Support => Enabled

Directive => Local Value => Master Value
ldap.max_links => Unlimited => Unlimited

libxml

libXML support => active
libXML Compiled Version => 2.7.6
libXML Loaded Version => 20706
libXML streams => enabled

mbstring

Multibyte Support => enabled
Multibyte string engine => libmbfl
HTTP input encoding translation => disabled

mbstring extension makes use of "streamable kanji code filter and converter", which is distributed under the GNU Lesser General Public License version 2.1.

Multibyte (japanese) regex support => enabled
Multibyte regex (oniguruma) backtrack check => On
Multibyte regex (oniguruma) version => 4.7.1

Directive => Local Value => Master Value
mbstring.detect_order => no value => no value
mbstring.encoding_translation => Off => Off
mbstring.func_overload => 0 => 0
mbstring.http_input => pass => pass
mbstring.http_output => pass => pass
mbstring.http_output_conv_mimetypes => ^(text/|application/xhtml\+xml) => ^(text/|application/xhtml\+xml)
mbstring.internal_encoding => no value => no value
mbstring.language => uni => neutral
mbstring.strict_detection => Off => Off
mbstring.substitute_character => no value => no value

mcrypt

mcrypt support => enabled
Version => 2.5.8
Api No => 20021217
Supported ciphers => cast-128 gost rijndael-128 twofish arcfour cast-256 loki97 rijndael-192 saferplus wake blowfish-compat des rijndael-256 serpent xtea blowfish enigma rc2 tripledes
Supported modes => cbc cfb ctr ecb ncfb nofb ofb stream

Directive => Local Value => Master Value
mcrypt.algorithms_dir => no value => no value
mcrypt.modes_dir => no value => no value

memcache

memcache support => enabled
Version => 3.0.6
Revision => $Revision: 310129 $

Directive => Local Value => Master Value
memcache.allow_failover => 1 => 1
memcache.chunk_size => 32768 => 32768
memcache.compress_threshold => 20000 => 20000
memcache.default_port => 11211 => 11211
memcache.hash_function => crc32 => crc32
memcache.hash_strategy => consistent => consistent
memcache.lock_timeout => 15 => 15
memcache.max_failover_attempts => 20 => 20
memcache.protocol => ascii => ascii
memcache.redundancy => 1 => 1
memcache.session_redundancy => 2 => 2

memcached

memcached support => enabled
Version => 1.0.0
libmemcached version => 0.31
Session support => yes
igbinary support => no

mhash

MHASH support => Enabled
MHASH API Version => Emulated Support

mongo

MongoDB Support => enabled
Version => 1.2.10

Directive => Local Value => Master Value
mongo.allow_empty_keys => 0 => 0
mongo.allow_persistent => 1 => 1
mongo.auto_reconnect => 1 => 1
mongo.chunk_size => 262144 => 262144
mongo.cmd => $ => $
mongo.default_host => localhost => localhost
mongo.default_port => 27017 => 27017
mongo.is_master_interval => 60 => 60
mongo.long_as_object => 0 => 0
mongo.native_long => 0 => 0
mongo.no_id => 0 => 0
mongo.ping_interval => 5 => 5
mongo.utf8 => 1 => 1

mssql

MSSQL Support => enabled
Active Persistent Links => 0
Active Links => 0
Library version => FreeTDS

Directive => Local Value => Master Value
mssql.allow_persistent => On => On
mssql.batchsize => 0 => 0
mssql.charset => no value => no value
mssql.compatability_mode => Off => Off
mssql.connect_timeout => 5 => 5
mssql.datetimeconvert => On => On
mssql.max_links => Unlimited => Unlimited
mssql.max_persistent => Unlimited => Unlimited
mssql.max_procs => Unlimited => Unlimited
mssql.min_error_severity => 10 => 10
mssql.min_message_severity => 10 => 10
mssql.secure_connection => Off => Off
mssql.textlimit => Server default => Server default
mssql.textsize => Server default => Server default
mssql.timeout => 60 => 60

mysql

MySQL Support => enabled
Active Persistent Links => 0
Active Links => 0
Client API version => 5.1.60
MYSQL_MODULE_TYPE => external
MYSQL_SOCKET => /var/run/mysqld/mysqld.sock
MYSQL_INCLUDE => -I/usr/include/mysql
MYSQL_LIBS => -L/usr/lib -lmysqlclient_r

Directive => Local Value => Master Value
mysql.allow_local_infile => On => On
mysql.allow_persistent => On => On
mysql.connect_timeout => 60 => 60
mysql.default_host => no value => no value
mysql.default_password => no value => no value
mysql.default_port => no value => no value
mysql.default_socket => /var/run/mysqld/mysqld.sock => /var/run/mysqld/mysqld.sock
mysql.default_user => no value => no value
mysql.max_links => Unlimited => Unlimited
mysql.max_persistent => Unlimited => Unlimited
mysql.trace_mode => Off => Off

mysqli

MysqlI Support => enabled
Client API library version => 5.1.60
Active Persistent Links => 0
Inactive Persistent Links => 0
Active Links => 0
Client API header version => 5.1.72
MYSQLI_SOCKET => /var/run/mysqld/mysqld.sock

Directive => Local Value => Master Value
mysqli.allow_local_infile => On => On
mysqli.allow_persistent => On => On
mysqli.default_host => no value => no value
mysqli.default_port => 3306 => 3306
mysqli.default_pw => no value => no value
mysqli.default_socket => no value => no value
mysqli.default_user => no value => no value
mysqli.max_links => Unlimited => Unlimited
mysqli.max_persistent => Unlimited => Unlimited
mysqli.reconnect => Off => Off

openssl

OpenSSL support => enabled
OpenSSL Library Version => OpenSSL 0.9.8k 25 Mar 2009
OpenSSL Header Version => OpenSSL 0.9.8k 25 Mar 2009

pcntl

pcntl support => enabled

pcre

PCRE (Perl Compatible Regular Expressions) Support => enabled
PCRE Library Version => 7.8 2008-09-05

Directive => Local Value => Master Value
pcre.backtrack_limit => 1000000 => 1000000
pcre.recursion_limit => 100000 => 100000

PDO

PDO support => enabled
PDO drivers => dblib, mysql, pgsql, sqlite, sqlite2

pdo_dblib

PDO Driver for FreeTDS/Sybase DB-lib => enabled
Flavour => freetds

pdo_mysql

PDO Driver for MySQL => enabled
Client API version => 5.1.60

pdo_pgsql

PDO Driver for PostgreSQL => enabled
PostgreSQL(libpq) Version => 8.4.17
Module version => 1.0.2
Revision =>  $Id: pdo_pgsql.c 293036 2010-01-03 09:23:27Z sebastian $

pdo_sqlite

PDO Driver for SQLite 3.x => enabled
SQLite Library => 3.6.22

pgsql

PostgreSQL Support => enabled
PostgreSQL(libpq) Version => 8.4.17
Multibyte character support => enabled
SSL support => enabled
Active Persistent Links => 0
Active Links => 0

Directive => Local Value => Master Value
pgsql.allow_persistent => On => On
pgsql.auto_reset_persistent => Off => Off
pgsql.ignore_notice => Off => Off
pgsql.log_notice => Off => Off
pgsql.max_links => Unlimited => Unlimited
pgsql.max_persistent => Unlimited => Unlimited

Phar

Phar: PHP Archive support => enabled
Phar EXT version => 2.0.1
Phar API version => 1.1.1
SVN revision => $Revision: 290435 $
Phar-based phar archives => enabled
Tar-based phar archives => enabled
ZIP-based phar archives => enabled
gzip compression => enabled
bzip2 compression => enabled
OpenSSL support => enabled

Phar based on pear/PHP_Archive, original concept by Davey Shafik.
Phar fully realized by Gregory Beaver and Marcus Boerger.
Portions of tar implementation Copyright (c) 2003-2009 Tim Kientzle.
Directive => Local Value => Master Value
phar.cache_list => no value => no value
phar.readonly => On => On
phar.require_hash => On => On

posix

Revision => $Revision: 293036 $

Reflection

Reflection => enabled
Version => $Revision: 293036 $

session

Session Support => enabled
Registered save handlers => files user memcache memcached sqlite
Registered serializer handlers => php php_binary wddx

Directive => Local Value => Master Value
session.auto_start => Off => Off
session.bug_compat_42 => Off => Off
session.bug_compat_warn => On => On
session.cache_expire => 180 => 180
session.cache_limiter => no value => nocache
session.cookie_domain => .example_domain.com.au => no value
session.cookie_httponly => On => Off
session.cookie_lifetime => 2000000 => 0
session.cookie_path => / => /
session.cookie_secure => Off => Off
session.entropy_file => no value => no value
session.entropy_length => 0 => 0
session.gc_divisor => 100 => 1000
session.gc_maxlifetime => 200000 => 1440
session.gc_probability => 1 => 1
session.hash_bits_per_character => 5 => 5
session.hash_function => 0 => 0
session.name => SESS4ff666585a2998676456e1e347dc5138 => PHPSESSID
session.referer_check => no value => no value
session.save_handler => user => files
session.save_path => /var/lib/php/session => /var/lib/php/session
session.serialize_handler => php => php
session.use_cookies => On => On
session.use_only_cookies => On => On
session.use_trans_sid => 0 => 0

shmop

shmop support => enabled

SimpleXML

Simplexml support => enabled
Revision => $Revision: 293036 $
Schema support => enabled

soap

Soap Client => enabled
Soap Server => enabled

Directive => Local Value => Master Value
soap.wsdl_cache => 1 => 1
soap.wsdl_cache_dir => /tmp => /tmp
soap.wsdl_cache_enabled => 1 => 1
soap.wsdl_cache_limit => 5 => 5
soap.wsdl_cache_ttl => 86400 => 86400

sockets

Sockets Support => enabled

SPL

SPL support => enabled
Interfaces => Countable, OuterIterator, RecursiveIterator, SeekableIterator, SplObserver, SplSubject
Classes => AppendIterator, ArrayIterator, ArrayObject, BadFunctionCallException, BadMethodCallException, CachingIterator, DirectoryIterator, DomainException, EmptyIterator, FilesystemIterator, FilterIterator, GlobIterator, InfiniteIterator, InvalidArgumentException, IteratorIterator, LengthException, LimitIterator, LogicException, MultipleIterator, NoRewindIterator, OutOfBoundsException, OutOfRangeException, OverflowException, ParentIterator, RangeException, RecursiveArrayIterator, RecursiveCachingIterator, RecursiveDirectoryIterator, RecursiveFilterIterator, RecursiveIteratorIterator, RecursiveRegexIterator, RecursiveTreeIterator, RegexIterator, RuntimeException, SplDoublyLinkedList, SplFileInfo, SplFileObject, SplFixedArray, SplHeap, SplMinHeap, SplMaxHeap, SplObjectStorage, SplPriorityQueue, SplQueue, SplStack, SplTempFileObject, UnderflowException, UnexpectedValueException

SQLite

SQLite support => enabled
PECL Module version => 2.0-dev $Id: sqlite.c 293036 2010-01-03 09:23:27Z sebastian $
SQLite Library => 2.8.17
SQLite Encoding => UTF-8

Directive => Local Value => Master Value
sqlite.assoc_case => 0 => 0

sqlite3

SQLite3 support => enabled
SQLite3 module version => 0.7-dev
SQLite Library => 3.6.22

Directive => Local Value => Master Value
sqlite3.extension_dir => no value => no value

standard

Dynamic Library Support => enabled
Path to sendmail => /usr/sbin/sendmail -t -i

Directive => Local Value => Master Value
assert.active => 1 => 1
assert.bail => 0 => 0
assert.callback => no value => no value
assert.quiet_eval => 0 => 0
assert.warning => 1 => 1
auto_detect_line_endings => 0 => 0
default_socket_timeout => 60 => 60
safe_mode_allowed_env_vars => PHP_ => PHP_
safe_mode_protected_env_vars => LD_LIBRARY_PATH => LD_LIBRARY_PATH
url_rewriter.tags => a=href,area=href,frame=src,input=src,form=fakeentry => a=href,area=href,frame=src,input=src,form=fakeentry
user_agent => no value => no value

sysvmsg

sysvmsg support => enabled
Revision => $Revision: 293036 $

tidy

Tidy support => enabled
libTidy Release => 25 March 2009
Extension Version => 2.0 ($Id: tidy.c 294893 2010-02-11 17:36:40Z johannes $)

Directive => Local Value => Master Value
tidy.clean_output => no value => no value
tidy.default_config => no value => no value

tokenizer

Tokenizer Support => enabled

uploadprogress

uploadprogress support => enabled
Version => 1.0.3.1

Directive => Local Value => Master Value
uploadprogress.file.contents_template => /tmp/upload_contents_%s => /tmp/upload_contents_%s
uploadprogress.file.filename_template => /tmp/upt_%s.txt => /tmp/upt_%s.txt
uploadprogress.get_contents => 0 => 0

wddx

WDDX Support => enabled
WDDX Session Serializer => enabled

xhprof

xhprof => 0.9.2
CPU num => 2

xml

XML Support => active
XML Namespace Support => active
libxml2 Version => 2.7.6

xmlreader

XMLReader => enabled

xmlrpc

core library version => xmlrpc-epi v. 0.51
php extension version => 0.51
author => Dan Libby
homepage => http://xmlrpc-epi.sourceforge.net
open sourced by => Epinions.com

xmlwriter

XMLWriter => enabled

xsl

XSL => enabled
libxslt Version => 1.1.26
libxslt compiled against libxml Version => 2.7.6
EXSLT => enabled
libexslt Version => 1.1.26

zip

Zip => enabled
Extension Version => $Id: php_zip.c 294817 2010-02-09 17:51:39Z pajoye $
Zip version => 1.9.1
Libzip version => 0.9.0

zlib

ZLib Support => enabled
Stream Wrapper support => compress.zlib://
Stream Filter support => zlib.inflate, zlib.deflate
Compiled Version => 1.2.1.1
Linked Version => 1.2.3.3

Directive => Local Value => Master Value
zlib.output_compression => Off => Off
zlib.output_compression_level => -1 => -1
zlib.output_handler => no value => no value

Additional Modules

Module Name
readline
sysvsem
sysvshm

Environment

Variable => Value
HISTTIMEFORMAT => %F %T
USER => example_domain
SSH_CLIENT => 203.160.3.130 40468 22
MAIL => /var/mail/example_domain
SHLVL => 2
HOME => /home/example_domain
SSH_TTY => /dev/pts/0
LC_CTYPE => en_GB.UTF-8
LOGNAME => example_domain
_ => /usr/local/bin/drush
COLUMNS => 203
TERM => xterm-256color
PATH => /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games
LANG => en_US.UTF-8
HISTSIZE => 10000000
SHELL => /bin/bash
PWD => /mnt/gfs/home/example_domain
SSH_CONNECTION => 203.160.3.130 40468 10.244.110.53 22

PHP Variables

Variable => Value
_GET["q"] => node
_SERVER["HISTTIMEFORMAT"] => %F %T
_SERVER["USER"] => example_domain
_SERVER["MAIL"] => /var/mail/example_domain
_SERVER["SHLVL"] => 2
_SERVER["HOME"] => /home/example_domain
_SERVER["SSH_TTY"] => /dev/pts/0
_SERVER["LC_CTYPE"] => en_GB.UTF-8
_SERVER["LOGNAME"] => example_domain
_SERVER["_"] => /usr/local/bin/drush
_SERVER["COLUMNS"] => 203
_SERVER["TERM"] => xterm-256color
_SERVER["PATH"] => /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games
_SERVER["LANG"] => en_US.UTF-8
_SERVER["HISTSIZE"] => 10000000
_SERVER["SHELL"] => /bin/bash
_SERVER["PWD"] => /mnt/gfs/home/example_domain
_SERVER["PHP_SELF"] => /index.php
_SERVER["SCRIPT_NAME"] => /index.php
_SERVER["SCRIPT_FILENAME"] => /usr/local/drush6/drush.php
_SERVER["PATH_TRANSLATED"] => /usr/local/drush6/drush.php
_SERVER["DOCUMENT_ROOT"] =>
_SERVER["REQUEST_TIME"] => 1401768739
_SERVER["argv"] => Array
(
    [0] => /usr/local/drush6/drush.php
    [1] => --php=/usr/bin/php
    [2] => --php-options= -d magic_quotes_gpc=Off -d magic_quotes_runtime=Off -d magic_quotes_sybase=Off
    [3] => @example_domain.prod
    [4] => php-eval
    [5] => phpinfo();
    [6] => --uri=example_domain.com.au
)

_SERVER["argc"] => 7
_SERVER["HTTP_HOST"] => example_domain.com.au
_SERVER["SERVER_PORT"] =>
_SERVER["REQUEST_URI"] => /index.php
_SERVER["REMOTE_ADDR"] => 127.0.0.1
_SERVER["REQUEST_METHOD"] =>
_SERVER["SERVER_SOFTWARE"] =>
_SERVER["HTTP_USER_AGENT"] =>
_SERVER["HTTP_REFERER"] =>
_SERVER["SERVER_PROTOCOL"] => HTTP/1.0
_ENV["HISTTIMEFORMAT"] => %F %T
_ENV["USER"] => example_domain
_ENV["MAIL"] => /var/mail/example_domain
_ENV["SHLVL"] => 2
_ENV["HOME"] => /home/example_domain
_ENV["SSH_TTY"] => /dev/pts/0
_ENV["LC_CTYPE"] => en_GB.UTF-8
_ENV["LOGNAME"] => example_domain
_ENV["_"] => /usr/local/bin/drush
_ENV["COLUMNS"] => 203
_ENV["TERM"] => xterm-256color
_ENV["PATH"] => /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games
_ENV["LANG"] => en_US.UTF-8
_ENV["HISTSIZE"] => 10000000
_ENV["SHELL"] => /bin/bash
_ENV["PWD"] => /mnt/gfs/home/example_domain
_ENV["AH_SITE_NAME"] => example_domain
_ENV["AH_SITE_GROUP"] => example_domain
_ENV["AH_SITE_ENVIRONMENT"] => prod
_ENV["AH_PRODUCTION"] => 1

PHP License
This program is free software; you can redistribute it and/or modify
it under the terms of the PHP License as published by the PHP Group
and included in the distribution in the file:  LICENSE

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

If you did not receive a copy of the PHP license, or have any
questions about PHP licensing, please contact license@php.net.
cpliakas commented 10 years ago

I definitely hear the concerns about moving away from getenv() however I want to help @jacobbednarz use the SDK and create an method or some sort of abstraction that allows us to swap it out for a more reliable method without being disruptive then I think we should accept a PR if the build doesn't break.

That is my $0.02.

webbj74 commented 10 years ago

My local

Running export AH_SITE_ENVIRONMENT=dev before phpunit has the following effect:

$_ENV['AH_SITE_ENVIRONMENT'] == 'dev' $_SERVER['AH_SITE_ENVIRONMENT'] == 'dev' getenv('AH_SITE_ENVIRONMENT') == 'dev'

On Travis CI

Adding this to .travis.yml:

env:
  global:
    - AH_SITE_ENVIRONMENT=dev

has the following effect on phpunit:

$_ENV['AH_SITE_ENVIRONMENT'] is unset $_SERVER['AH_SITE_ENVIRONMENT'] == 'dev' getenv('AH_SITE_ENVIRONMENT') == 'dev'

On Acquia Hosting

Testing the values after including the "settings.inc" for a site has the following:

$_ENV['AH_SITE_ENVIRONMENT'] == 'dev' $_SERVER['AH_SITE_ENVIRONMENT'] is unset getenv('AH_SITE_ENVIRONMENT') is FALSE

It looks like the Acquia "settings.inc" does the following:

./mysite-settings.inc:80:  if (!isset($_ENV['AH_SITE_GROUP'])) {
./mysite-settings.inc:81:    $_ENV['AH_SITE_GROUP'] = $ah_site_group;

It appears to me that getenv's variable list is set to $_ENV and $_SERVER when PHP first initializes. Altering the superglobals after the fact has no effect on getenv. Similarly putenv does not appear to alter the superglobals:

Acquia (PHP 5.3.2-1ubuntu4.19) $ php -a
Interactive shell

php > printf("getenv('FOO') == %s\n", getenv('FOO') ? getenv('FOO') : 'FALSE');
getenv('FOO') == FALSE
php > $_ENV['FOO'] = 'bar';
php > printf("getenv('FOO') == %s\n", getenv('FOO') ? getenv('FOO') : 'FALSE');
getenv('FOO') == FALSE
php > $_SERVER['FOO'] = 'bar';
php > printf("getenv('FOO') == %s\n", getenv('FOO') ? getenv('FOO') : 'FALSE');
getenv('FOO') == FALSE
php > putenv('FOO=test');
php > printf("getenv('FOO') == %s\n", getenv('FOO') ? getenv('FOO') : 'FALSE');
getenv('FOO') == test
php > print "\$_ENV['FOO'] == {$_ENV['FOO']}\n";
$_ENV['FOO'] == bar
php > print "\$_ENV['SERVER'] == {$_SERVER['FOO']}\n";
$_ENV['SERVER'] == bar
php >

This behavior seems consistent on Acquia's various CLI versions...

Conclusion

So it seems to me like Acquia's method for setting values for CLI is what is inconsistent here, not acquia-sdk-php. I feel Acquia should do a putenv("AH_SITE_GROUP={$ah_site_group}"); in addition to $_ENV['AH_SITE_GROUP'] = $ah_site_group; I think there are a handful of affected files:

jacobbednarz commented 10 years ago

Thanks for the confirmation @webbj74 - It mimics the results I seen within our Acquia environments. Regarding the proposed putenv() update, would you like to open a ticket internally for that and just keep an eye on the progress and then perhaps ping back to this repository when/if it is fixed?

In the mean time, is everyone happy if I just add a helper method to the CloudEnvironmentTest file and get this build passing?

jacobbednarz commented 10 years ago

And just utilise the $_ENV['AH_SITE_ENVIRONMENT'] for the library itself?

webbj74 commented 10 years ago

Have a look at my approach in https://github.com/webbj74/acquia-sdk-php/commit/4c0a73

This passed tests without needing to modify .travis.yml (though for the record it also passed tests with the config I mentioned previously).

I can create a separate PR for this if needed (I don't have perms to add commits to this one).

jacobbednarz commented 10 years ago

Nice! :thumbsup:

Yeah, if you want to use that, I can close mine off. Thanks for the continued support with this - appreciate it.