Categories
Workflow

PHP Monitor and Getting Stuck on an Old Version

I swapped to old PHP 7.4 to update a WordPress project. I then could not switch back to 8.2+. I had the Laravel installer in the global composer dependency, which prevented running composer global update

Go to /Users/mike/.composer/ and temporarily remove the Laravel installer to be able to swap, then can probably put it back afterwards.

Categories
Workflow

Local Meilisearch

brew services start meilisearch

Or, if you don’t want/need a background service you can just run:

/opt/homebrew/opt/meilisearch/bin/meilisearch –db-path /opt/homebrew/var/meilisearch/data.ms

Categories
DevOps Workflow

Homebrew PHP Monitor Broken

I think this happened when something interrupted the switch.

brew install php got me on the way.

Categories
Workflow

SSH Authentication in WSL

Seems like the ssh-agent can go to sleep.

Within WSL I ran:

eval `ssh-agent`
ssh-add -l  //to see keys in use
ssh-add ~/.ssh/my_private_key  // to add it
Categories
Workflow

Installing Lando / Docker for WSL2

I’m working on this for the Windows host. The official Lando docs are out of date, referring to Ubuntu 18 and Hyerdrive which I read is not well maintained.

I found this blog post that hopefully is the way forward.

Categories
Workflow

ExifTool

I needed to modify the meta data (title) of a PDF. This tool was pretty good! Cheers Phil Harvey.

https://exiftool.org/

Categories
PHP Workflow

Switching local PHP versions with Homebrew

At the time of writing PHP 8.1 is the default, and I have 7.4 and 8.0 installed.

To swap them around link/unlink and then stop and start the appropriate Homebrew service.

Linking changes CLI version; starting the service affects the version Nginx connects to.

You may also want to change the binary that Tinkerwell loads.

Odd Bits

The syntax to link unlink PHP 8.1 (default) are different to the other two. I would not have a clue why.

When you stop a PHP service, sometimes a “fallback” one automatically starts. It might not be the one you want, so you have to stop it and start the one you need.

PHP 8.1

brew unlink php && brew link php

Other versions

brew link --overwrite --force php@7.4
// or 
brew link --overwrite --force php@8.0

Starting the Homebrew service

brew services list
brew services stop php@8.0 
brew services start php
brew services start php@7.4    etc...
Categories
DevOps Workflow

Upgrading to PHP8.0 Locally

Added PHP8.0 with Homebrew. I’m using the shivammathur/homebrew-php tap as recommended in Brent’s post.

Steps

  • brew tap shivammathur/php
  • brew install shivammathur/php/php@8.0
    That seemed to immediately link it. CLI reported 8.0 after that ran.
  • Nginx automatically used it via php-fpm once I restarted Nginx and the PHP service (and Redis)
nginx-restart //(custom alias I have set in .zshrc)
brew services restart php
brew services restart redis

Switching Versions

I think this will just be a matter of brew linking the desired version (if already installed), and restarting php/nginx.

brew link --overwrite --force php@8.0

I’m not totally sure what the old 7.4 is called as far as Brew is concerned. It was the default back when I installed it, so maybe it’s just php , or possibly php@7.4

(A similar thing will probably happen now that PHP 8.1 is the default. I installed PHP 8.0 when it was, so it’s just php . Is it now php@8.0 ?)

Categories
Workflow

Git Track new branch

Commit changes to new local branch, then:

git push -u origin new_branch_name

Categories
Workflow

Remove Files from Git Repo

From: https://medium.com/better-programming/how-to-remove-committed-files-from-git-version-control-b6533b8f9044


  1. Create a .gitignore file, if you haven’t already
  2. Edit .gitignore to match the file/folder you want to ignore
  3. Execute the following command: 
    git rm --cached path/to/file
  4. Git will list the files it has deleted. The --cached flag should be used if you want to keep the local copy but remove it from the repository.
  5. Verify that these files are being deleted from version control using git status
  6. Push the changes to the repository

After completing these steps, those files should be removed from version control but not removed from any local machine. Any other developer which pulls again after you pushed your changes should have no issues.

How To Remove Committed Files From Git Version Control