Setup Activity Template
Background
In 2019-2020, when this activity template project was written in PHP, it had already stopped development, but it’s still running, with over 400 activities running on it. I remember when I left, there were only over 50, and now PHP is no longer popular in China, if not for the high migration cost, it would have been changed to Java long ago. However, knowing that the code I wrote is still running, and so many activities have been launched, it’s still quite heartening to think about the development cost saved.
This time, I plan to rebuild the activity template and record the problems encountered along the way. After all, for a 5-year-old project, many of the software dependencies have been updated, and various problems will arise.
PHP 7.2
By 2024, PHP has already reached 8.X, and some features are no longer supported, so an older version must be installed.
However, Homebrew’s official does not provide downloads for older versions, and shivammathur/homebrew-php
must be used.
shivammathur/homebrew-php
Homebrew PHP extension
Homebrew
Start Service
View Service
MySQL 8.4
MySQL has also jumped from 5 to 8, and here we directly install 8.4.
Authentication Error
When PHP 7.2 connects to the database, it will report the following error.
For security reasons, MySQL 8.0 and later introduced a new authentication method caching_sha2_password
,
which is incompatible with the mysql_native_password
used by older clients.
There are two solutions, one is to upgrade the client, and the other is to enable the old module.
Here, the simplest method is to enable the mysql_native_password
module for MySQL 8.4.
Add the following configuration in the [mysqld]
module.
Restart the MySQL service.