php 安装pthread 提示 Class 'Thread' not found

WBOY
Release: 2016-06-23 13:09:25
Original
2900 people have browsed it

我的php版本是5.6.16   系统是64位 下载的pthread为  php_pthreads-2.0.8-5.6-ts-vc11-x64.zip  从phpinfo里 查看的  Compiler MSVC11 (Visual C++ 2012) 为 vc11 ,版本对对应

我的路径是 E:\wamp64\bin\php\php5.6.16\
把 php_pthreads.dll 放到了 E:\wamp64\bin\php\php5.6.16\ext\目录下   
,把 pthreadVC2.dll 放到了  E:\wamp64\bin\php\php5.6.16\ 目录下,
同时把pthreadVC2.dll  放到了system32目录下,
也添加了环境变量,配置了apache 的http.conf  添加 LoadFile  "E:/wamp64/bin/php/php5.6.16/pthreadVC2.dll"

修改了php.ini extension=php_pthreads.dll

重启apache后执行以下代码

class AsyncOperation extends Thread {  public function __construct($arg){    $this->arg = $arg;  }  public function run(){    if($this->arg){      printf("Hello %s\n", $this->arg);    }  }}$thread = new AsyncOperation("World");if($thread->start())  $thread->join();
Copy after login

仍然提示 
 Class 'Thread' not found 

请教一下大家可能是因为什么原因



回复讨论(解决方案)

Phpinfo函数看看加载成功吗?

http://m.blog.csdn.net/article/details?id=19020161

http://m.blog.csdn.net/article/details?id=19020161

  是按照这个教程执行的,提示  Class 'Thread' not found  phpinfo显示没有加载上php_pthread

同时把pthreadVC2.dll  放到了system32目录下,

这篇教程没有这个操作吧

同时把pthreadVC2.dll  放到了system32目录下,

这篇教程没有这个操作吧

 没有  因为按照这个教程操作以后,提示找不到这个类 ,所以参考了其他教程

后来又参考的这个教程  http://www.thinkphp.cn/topic/22676.html

看看官方的http://docs.php.net/manual/zh/book.pthreads.php

看样子是没有安装成功,看看phpinfo有没有。

看看官方的http://docs.php.net/manual/zh/book.pthreads.php



看样子是没有安装成功,看看phpinfo有没有。

  phpinfo 没有

看看官方的http://docs.php.net/manual/zh/book.pthreads.php

  按照官方文档都添了 还是找不到thread

phpinfo没有表示安装失败了,换另一个版本安装看看。

配置错误,导置的

谢谢大家的热心解答  问题已解决  按照http://docs.php.net/manual/zh/book.pthreads.php 官方教程配置的    我用的集成环境wamp 在php.ini里配置的时候 用的是 php下的php.ini, 但是wamp加载的不是这个php.ini   后来通过wamp图标找到php.ini 打开配置的,才可以显示

source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!