Archive for the ‘MAMP’ Category

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):

Add to php7.2.10

“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://

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’;}”


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

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>

MAMP host & vhosts

Tuesday, January 15th, 2019

You Must Use the MAMP files, NOT the Apple default system versions!

  1. Update the hosts file in /etc/hosts
    add: newsitename.local
  2. Create a vhost in: /Applications/MAMP/conf/apache/extra/httpd-vhost.conf
  3. In this file: /Applications/MAMP/conf/apache/httpd.conf
    Uncomment this line
    #Include /Applications/MAMP/conf/apache/extra/httpd-vhosts.conf
  4. Then in httpd-vhosts.conf, add a default localhost vhost, AND any new sites you need:
<VirtualHost *:80>
    DocumentRoot "/Applications/MAMP/htdocs"
    ServerName localhost

<VirtualHost *:80>
    DocumentRoot "/Applications/MAMP/htdocs/newsitename"
    ServerName newsitename
    ServerAlias newsitename
    ErrorLog "logs/"
    CustomLog "logs/" common

Then check via Terminal:
cd /Applications/MAMP/Library/bin
apachectl -S


If you’re using these, they’re not going to work!

If you’re pointing to a WordPress, you’ll have to update domain values in the database, and possibly wp-content.php for it not to forward after the server logic, to the values in the db!