Skip to content

Instantly share code, notes, and snippets.


Jonathan Aaron Steel stamster

View GitHub Profile
stamster /
Created May 7, 2016
Magento2 INIT script
MAG=magento #system wide symlink
# or absolute:
#MAG=/usr/share/nginx/mymagentoprojectroot/bin/magento #absolute path
echo "Enabling all modules with clearing static content..."
$MAG module:enable --all --clear-static-content
echo "Running setup upgrade..."
$MAG setup:upgrade
View ldap_safe_connect
If you don't want your PHP program to wait XXX seconds before giving up in a case when one of your corporate DC have failed,
and since ldap_connect() does not have a mechanism to timeout on a user specified time,
this is my workaround which shows excellent practical results.
function serviceping($host, $port=389, $timeout=1)
$op = fsockopen($host, $port, $errno, $errstr, $timeout);
if (!$op) return 0; //DC is N/A