Redis.dll not found for php8.2
Asked Answered
P

2

6

I am experiencing difficulties starting Redis 5.3.7 with PHP 8.2 on my Windows machine. When I attempt to start it, a dialog box displays with the message:

"The procedure entry point _zend_get_parameters_array_ex could not be located in the dynamic link library c:\Program Files\php\ext\php_redis.dll"

I have included a screenshot of the error below:

error screenshot

Protomorphic answered 17/6, 2023 at 13:49 Comment(0)
P
13

Here the way I solve the problem

DLL is Officially released in PHP packages site you can find the package here

Redis 6.0.2 https://pecl.php.net/package/redis/6.0.2/windows

Redis 5.3.7 https://pecl.php.net/package/redis/5.3.7/windows

My Old Solution:

go to this page https://github.com/phpredis/phpredis/actions/runs/5916330188#artifacts, extensions are listed there.

working for me on xampp, php8.2.1 and redis 3.2.100 on windows 11

Protomorphic answered 17/6, 2023 at 13:49 Comment(1)
For any newer version you can do this: Go to phpredis on GitHub → select desired branch (e.g. releases/6.0.2) → click on the green "✔" next to commit message → click on "Details" next to any ci.yml job → click on "Summary" in the left sidebar → scroll down to the "Artifacts" section → download desired versionLuck
S
6

How to compile a PHP extension like Redis, under Windows. Since nobody really explains that.

Run commands under the old Windows shell, e.g. cmd.exe

You will need the 2019 version of the Microsoft C/C++ compiler, so the linker is compatible with the downloadable PHP for Windows. winget can found as "App Installer" in the Windows Store.

winget install --id Microsoft.VisualStudio.2022.BuildTools

In the Visual Studio Build Tools 2022 'modify' the install under the 'Individual components' tab, and select:

  • C++/CLI support for v142 build tools (14.29-16.11)
  • MSVC v142 - VS 2019 C++ x64/x86 build tools

Download PHP for Windows, also download and unzip the 'Development package (SDK to develop PHP extensions)' and probable also the 'Debug Pack'. In the 'Development package' there is a folder, you need to unzip the contents of that folder to the folder where you have php.exe. https://windows.php.net/download#php-8.2

Git clone https://github.com/phpredis/phpredis inside the folder where you have php.exe.

winget install --id Git.Git
git clone https://github.com/phpredis/phpredis.git
# or:
winget install --id Git.Git
winget install --id GitHub.cli
gh repo clone phpredis/phpredis

You might want to switch away from the main develop branch:

git tag # find the latest non-RC version, currently that is 5.3.7
git checkout 5.3.7

In a command shell cmd.exe inside the directory where you have php.exe.

"C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Auxiliary\Build\vcvars64.bat" -vcvars_ver=14.29
cd phpredis 
..\phpize.bat
.\configure.bat --enable-redis --with-prefix=%cd%\..

Check that in the Makefile PHP_PREFIX and PHP_SRC_DIR point to the directory holding php.exe and the phpredis source code, e.g.

  • PHP_SRC_DIR ="C:\laragon\bin\php\php-8.2.7-Win32-vs16-x64\phpredis"
  • PHP_PREFIX="C:\laragon\bin\php\php-8.2.7-Win32-vs16-x64\"

Then build with:

nmake clean
nmake
copy x64\Release_TS\php_redis.dll ..\ext\

In the php.ini:

extension=php_redis.dll

Then run php -m to see redis listed.

Stonge answered 20/6, 2023 at 6:31 Comment(3)
It's interesting that you have to recompile php to run the extension.Cheer
You don't recompile PHP. Nowhere do I compile PHP. You if you want to run a really new PHP version under Windows, with an 'obscure' extension, you will need to compile just that extension. To build that extension you need some files (the 'Development package') that are normally cleaned up before PHP for Windows is zipped for you to use. The Development package files are not needed when you run a pure PHP site, so they are normally not included.Stonge
After a few weeks to months, you can usually download the extension compiled by 'some rando' or the project themselves. But redis 5.3.7 for Windows was never released for PHP 8.2 on PECL. There is probably technically an incompatibility, but I haven't encountered in my minimal local development use.Stonge

© 2022 - 2024 — McMap. All rights reserved.