If you're receiving this error when trying to composer install
.
Your GitHub OAuth token for github.com contains invalid characters
The solution is to update Composer to the latest version, which supports the new token format, as suggested by Jordi Boggiano on this tweet. "Composer 1.10.21 and 2.0.12 (both released April 1st) added support for the new GitHub token format."
phar
The following command will install the latest version of Composer on your machine—v2.2.6
as of this writing. Note that future Composer updates will break the script as shown here, as the sha384 hash check won't pass.
php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');"
php -r "if (hash_file('sha384', 'composer-setup.php') === '906a84df04cea2aa72f40b5f787e49f22d4c2f19492ac310e8cba5b96ac8b64115ac402c8cd292b8a03482574915d1a8') { echo 'Installer verified'; } else { echo 'Installer corrupt'; unlink('composer-setup.php'); } echo PHP_EOL;"
php composer-setup.php
php -r "unlink('composer-setup.php');"
You can use Homebrew to install (or reinstall) composer on macOS.
brew install composer
brew reinstall composer
2021.04.20
As I mentioned above, both Lukas Kahwe Smith and Jordi Boggiano discouraged tinkering with Composer's auth.json
file manually and recommended upgrading Composer to its latest version instead.
Still, here's the brute-force fix that worked for me. Apparently, editing the auth.json
is the only way to update to the latest Composer programmatically, and you can revert it to its original state if you opt for this option. The alternative, of course, is to upgrade as shown above.
Edit the composer authentication configuration file ~/.composer/auth.json
.
nano ~/.composer/auth.json
Then replace the following.
"github-oauth": {
"github.com": "ghp_[YOUR-PERSONAL-TOKEN]"
}
With this (basic auth):
"http-basic": {
"github.com": {
"username": "[YOUR-GITHUB-USERNAME]",
"password": "ghp_[YOUR-PERSONAL-TOKEN]"
}
}
To Lukas Kahwe Smith and Jordi Boggiano for pointing this out on Twitter.
I found this error while trying to update and install composer packages with composer install
.
could not find driver (SQL: select * from information_schema.tables where table_schema = folio_burns and table_name = folio_items and table_type = 'BASE TABLE')
At first, I thought the solution was to edit /etc/php/7.4/cli/php.ini
(for PHP-FPM 7.4 in my case) and uncomment the line ;extension=pdo_mysql
to be like extension=pdo_mysql
. But I was still getting this error as the mysql
extension was missing.
PHP Warning: PHP Startup: Unable to load dynamic library 'pdo_mysql' (tried: /usr/lib/php/20190902/pdo_mysql (/usr/lib/php/20190902/pdo_mysql: cannot open shared object file: No such file or directory), /usr/lib/php/20190902/pdo_mysql.so (/usr/lib/php/20190902/pdo_mysql.so: cannot open shared object file: No such file or directory)) in Unknown on line 0
The solution ended up being to install the extension, which would also add its own .ini
file and activate itself on installation.
sudo apt-get install -y php7.4-mysql
Note that you can run this command with multiple extensions to be installed at once.
sudo apt-get install -y php7.4-{xml,bcmath,gd,mbstring,xsl,zip,curl,mysql}