Skip to content

Instantly share code, notes, and snippets.


Jonathan Aaron Steel stamster

Block or report user

Report or block stamster

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
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
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
You can’t perform that action at this time.