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

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

<VirtualHost *:80>
    ServerAdmin youremail@yourdomain.com
    DocumentRoot "/Applications/MAMP/htdocs/newsitename"
    ServerName newsitename
    ServerAlias newsitename
    ErrorLog "logs/dummy-host.example.com-error_log"
    CustomLog "logs/dummy-host.example.com-access_log" common
</VirtualHost>

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

NOTES!

If you’re using these, they’re not going to work!
/etc/apache2/httpd.conf
/etc/apache2/extra/http-vhost.conf

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!