php - 在 Windows 中安装 pthread 时遇到问题
问题描述
PHP版本: 7.4.5
我正在运行 PHP 的线程安全版本,因为php -i|findstr "Thread"
我得到:
Thread Safety => enabled
Thread API => Windows Threads
我从以下网址下载了最新版本的 pthreads (3.1.6):https ://windows.php.net/downloads/pecl/releases/pthreads/3.1.6/ (我尝试了 32 位和 64 位版本)。
我将pthreadVC2.dll
文件放在我的php\
目录中,将php_pthreads.dll
文件放在我的php\ext\
目录中,并将该行添加extension=php_pthreads.dll
到我的php.ini
文件中
然后通过命令行运行任何 php 命令后(在我的情况下,php -v
)我在尝试 32 位版本时在控制台中得到以下内容:
PHP Warning: PHP Startup: Unable to load dynamic library 'php_pthreads.dll' (tried: C:\xampp\php\ext\php_pthreads.dll (%1 is not a valid Win32 application.), C:\xampp\php\ext\php_php_pthreads.dll.dll (The specified module could not be found.)) in Unknown on line 0
Warning: PHP Startup: Unable to load dynamic library 'php_pthreads.dll' (tried: C:\xampp\php\ext\php_pthreads.dll (%1 is not a valid Win32 application.), C:\xampp\php\ext\php_php_pthreads.dll.dll (The specified module could not be found.)) in Unknown on line 0
PHP 7.4.5 (cli) (built: Apr 14 2020 16:17:34) ( ZTS Visual C++ 2017 x64 )
Copyright (c) The PHP Group
Zend Engine v3.4.0, Copyright (c) Zend Technologies
尝试 64 位版本时出现此错误:
PHP Warning: PHP Startup: Unable to load dynamic library 'php_pthreads.dll' (tried: C:\xampp\php\ext\php_pthreads.dll (The specified procedure could not be found.), C:\xampp\php\ext\php_php_pthreads.dll.dll (The specified module could not be found.)) in Unknown on line 0
Warning: PHP Startup: Unable to load dynamic library 'php_pthreads.dll' (tried: C:\xampp\php\ext\php_pthreads.dll (The specified procedure could not be found.), C:\xampp\php\ext\php_php_pthreads.dll.dll (The specified module could not be found.)) in Unknown on line 0
PHP 7.4.5 (cli) (built: Apr 14 2020 16:17:34) ( ZTS Visual C++ 2017 x64 )
Copyright (c) The PHP Group
Zend Engine v3.4.0, Copyright (c) Zend Technologies
有任何想法吗?
解决方案
如果有人遇到这种情况,那么为我解决的问题是将我的文件中的extension_dir
设置修复为实际从同一目录中存在的文件夹中php.ini
提取。ext
该行已被注释掉,所以我认为它的默认设置是尝试从C:\php\ext
.
推荐阅读
- php - 从表单中获取数据并将其作为 HTTP 请求发送
- python - 使用 Scikit-Learn 的多元分类和回归模型的准确性
- python - 在 python 中,并行运行可执行的 .exe 而无需等待 .exe 完成
- javascript - 反应器模式在 Node.js 中是如何工作的?
- amazon-web-services - 在 Cognito PreSignUp_SignUp 触发器中设置密码?
- php - 根据 EasyAdminBundle 中的语言设置日期和日期时间列
- c++ - 需要帮助比较属于类的数组
- unity3d - Google play 在我的 Unity 游戏中检测到 android 广告 ID。在哪里?
- c - Printf 不打印 - 返回 NULL
- kobo - 如何使用 Kobo API 将数据发布到 kobotoolbox 表单?