Use XAMPP's PHP with composer to update Drupal 8

MacOS Terminal

There are multiple ways to update your Drupal 8 installation but I prefer using composer for ease of use. However, if you have multiple PHP installations on your system, composer may use the wrong PHP version. Typically, you would update your Drupal 8 installation like this:

composer update drupal/core --with-dependencies

You may run into errors of missing PHP extensions like (ext-zip) or memory limit errors because of the default and un-configured PHP version.

On my local development environment, I'm running XAMPP on a MacOS Catalina. To use the version of PHP within my XAMPP installation with composer to update my Drupal 8 installation, I would enter the following:

/Applications/XAMPP/xamppfiles/bin/php /usr/local/bin/composer update drupal/core --with-dependencies

You can also apply this setting in your .bash_profile so composer will remember next time you use it.

alias php="/Applications/XAMPP/bin/php"
alias composer="php /Applications/XAMPP/bin/composer.phar"

 

Add new comment

Plain text

  • No HTML tags allowed.
  • Lines and paragraphs break automatically.
  • Web page addresses and email addresses turn into links automatically.