Archive for the ‘Terminal’ Category

Linux File Permissions -> number reference

Thursday, June 13th, 2019

This is kind of silly, but sometimes I just need to quickly find common ones:

  • drwx—r-x = 705
  • -rwx—r-x = 705
  • drw—-r– = 604
  • -rw—-r– = 604
  • drw-r–r– = 644
  • -rw-r–r– = 644
  • drwxr–r-x = 745
  • -rwxr–r-x = 745
  • drwxr-xr-x = 755
  • -rwxr-xr-x = 755

MAC: find active php.ini, add mcrypt extension to php7.2.10, verify

Thursday, February 7th, 2019

Find your active php.ini:
php -i | grep ‘Configuration File’
php –info | grep php.ini

Add extension to your php.ini (anywhere):
extension=mcrypt.so

Add mcrypt.so to php7.2.10
Credit: https://stackoverflow.com/questions/42504777/enable-mcrypt-using-mamp

“Go to bin directory inside current active PHP version directory. In my case it is /Applications/MAMP/bin/php/php7.2.10/bin
It might be different in your case. Now run the below command with sudo”

sudo ./pecl install channel://pecl.php.net/mcrypt-1.0.1

Could also need to have done:
brew install autoconf mcrypt

Now check that it’s active via one of these:

if(function_exists('mcrypt_encrypt')) {
    echo "mcrypt is loaded!<br />";
} else {
    echo "mcrypt isn't loaded!<br />";
}

if(extension_loaded('mcrypt')) {
    echo "mcrypt extension is loaded!<br />";
} else {
    echo "mcrypt extension isn't loaded!<br />";
}

or on the command line:
php -r “if(function_exists(‘mcrypt_encrypt’)){echo ‘exists’;}else{echo ‘nope’;}”

Credit: https://stackoverflow.com/questions/25476889/how-to-check-if-mcrypt-extension-exists-on-php

WordPress CLI wp-cli notes

Friday, January 25th, 2019

wp core download
wp cli version
wp cli update
wp user list
wp user update {user ID or login} –user_pass
wp plugin list
wp plugin activate/deactive/delete/install/uninstall {plugin} –activate
wp plugin update –all
wp theme delete {theme}
wp theme update –all
wp config set WP_DEBUG true –raw
other useful config parameters: WP_DEBUG_LOG, WP_DEBUG_DISPLAY, WP_MEMORY_LIMIT, WP_MAX_MEMORY_LIMIT

wp package install wp-cli/admin-command
if “wp-cli ran out of memory”:
php -d memory_limit=512M “$(which wp)” package install <package-name>

wp-config.php version of the same:
define( ‘WP_DEBUG_LOG’, true );
define( ‘WP_DEBUG_DISPLAY’, false );
define(‘WP_MEMORY_LIMIT’, ‘512M’);
define( ‘WP_MAX_MEMORY_LIMIT’, ‘512M’ );

wp package install wp-cli/admin-command
if “wp-cli ran out of memory”:
php -d memory_limit=512M “$(which wp)” package install <package-name>

Mac, Symlink, Terminal

Thursday, January 24th, 2019

ln -S “I’d like to see THIS” “HERE”

Example:
ln -S “/Documents/funProject/wp-content/themes/greatTheme” “/Applications/MAMP/htdocs/funProject/wp-content/themes”