Instantly share code, notes, and snippets.

James Deathe jdeathe

View GitHub Profile
View php-curl-status.php
$responseCode = 500;
$responseCodeOk = 200;
$responseCodeFail = 503;
$url = '';
$ch = curl_init();

Generate a File Listing for Review


  • Last Modified
  • Size (bytes)
  • Relative Path


Replace {{search-path}} with the path to search.


Identify PHP FastCGI Process Memory Usage

pmap -x $(ps ax \
  | grep php-cgi \
  | grep -v grep \
  | awk '{ print $1 }' \
  | awk -v RS='' '{ gsub("\n", " "); print; }'\
) | grep -E '^(Address|total)'

How to Enable MySQL Query Logging at Runtime

From the mysql client run:

mysql> SET GLOBAL general_log=true;
mysql> SET GLOBAL general_log_file='general.log';

After this queries will be logged to the named file located in the MySQL data directory. e.g. /var/lib/mysql/general.log.


Identify Unavailable IUS PHP Packages Between 5.6 and 7.1

For all installed packages prefixed with php56u, check for availability php71u package.

# yum list installed \
| grep -o '^php56u[^ ]*' \
| { \
  mapfile -t packages; \
  for package in "${packages[@]}"; do \

The output of apachectl -S is really useful but it's not easy to parse in a script. To make it easier to find the configuration file for a given NameVirtualHost host the following BASH one liner returns lines of output that can be easily parsed.

# apachectl -S 2>&1 \
| sed -rn -e '/NameVirtualHost$/,$ { /NameVirtualHost$/d; $ d; p; }' \
| sed -rn -e 's/^.*(port ([0-9]+) namevhost|alias) ([^ ]*)( )?(\((.*):[0-9]+\)|$)/\2 \6\n\3/p' \
| sed -r -e '/^$/d' -e 's/(.*\.conf$)/\n\1/g' \
| awk -vRS='' '$1=$1' \
| sort -n \
| uniq

Requesting a Wildcard Certificate with Certbot on CentOS

To request a Let's Encrypt wildcard certificate there are the following prerequisites:

  • The client must support ACME v2 (i.e Certbot >= 0.22.0)
  • The DNS-01 challenge type must be used.
  • The --server option or configuration directive must be changed to the appropriate v2 endpoint.


Install certbot-auto

View grow-root.service
# To install:
# sudo cat grow-root.service > /etc/systemd/system/grow-root.service
# sudo systemctl daemon-reload
# sudo systemctl enable -f grow-root.service
# Start (auto disables after first successful expansion):
# sudo systemctl start grow-root.service
# Debugging:
# sudo systemctl status grow-root.service

Jadu Continuum CMS - Readable URLs for Custom Scripts

The recommended location for custom scripts written for the Jadu CMS platform is within /public_html/site/custom_scripts/ but this can lead to long and unfriendly URLs. Here we show how to use the Readable URLs feature to create a cleaner URL structure for a simple custom script.


  1. Create a new directory <install-path>/public_html/site/custom_scripts/php_version and populate it with the following files:
  • htaccess_readable

Keybase proof

I hereby claim:

  • I am jdeathe on github.
  • I am jdeathe ( on keybase.
  • I have a public key whose fingerprint is B076 A415 B14E 9393 BD6A BCE7 9071 AD75 7AE1 E9CE

To claim this, I am signing this object: