When beginners learn PHP through tutorial videos, they often encounter the need to enable extensions like openssl
and curl
, which can be activated by simply modifying the php.ini
file. However, installing extensions like redis
and memcache
requires finding the correct versions matching their PHP, NTS, VC, and Windows environment - a process that’s straightforward for experienced developers but challenging for newcomers.
To solve this problem, we’ve developed a one-click PHP extension installer program. The core workflow is as follows:
+--------------+ +----------------+ +------------+
| open service | php install redis | down redis.dll | php index | show |
| lamp/lnmp |------------------> | move redis.dll | ---------> | extensions |
| environment | | update php.ini | | list |
+--------------+ +----------------+ +------------+
Extensions are divided into two types:
- Those requiring DLL file downloads
- Those that can be enabled directly
Extensions needing downloads are stored in the Extensions
directory with a $mapUrl
array containing key-value pairs:
- Key: Environment version
- Value: Extension package download URL
Installation process:
php install redis
detects the current environment version to construct the download URL- Downloads and extracts the compressed package
- Copies DLL files to the PHP extensions directory
- Updates the
php.ini
configuration
Usage examples:
# Install redis extension
php install redis
# Install memcache extension
php install memcache
# View enabled extensions (restart server after installation)
php index
# Rollback php.ini configuration
php install rollback
Supported extensions and detailed instructions can be found in the Github documentation.
Developers are welcome to contribute extension URLs and names to improve the program. If you find this tool helpful, please give it a ⭐ on GitHub!