windows PHP5.6 + apache2.4 +redis +pthreads 线程

来源:互联网 发布:泰拳训练软件 编辑:程序博客网 时间:2024/05/27 21:02

1、下载php5.6apache2.4php下载ts vc11

百度云软件包:http://pan.baidu.com/s/1dFMJP77

PHP下载地址:http://windows.php.net/download#php-7.1

下载线程安全的php版本

PAPACHE下载地址:http://httpd.apache.org/docs/current/platform/windows.html#down

 


 

2、配置PHP+APACHE

a) 配置php

复制 php.ini-development 文件,并命名为 php.ini

编辑php.ini如下

更改 ;extension_dir = ‘ext’   extension_dir = "D:/php5.6/php-5.6.29/ext"D:/php5.6/php-5.6.29/extphp的扩展目录)

b)配置apache

D:\php5.6\Apache24\conf 中,编辑httpd.conf。添加一下代码

LoadModule php5_module "D:/php5.6/php-5.6.29/php5apache2_4.dll"

AddHandler application/x-httpd-php .php

PHPIniDir "D:/php5.6/php-5.6.29"

c)在D:\php5.6\Apache24\bin下,安装shift键,单击鼠标右击,单击在此处打开命令窗口

 

如果下面光标一直闪烁,则apache正常启动,如果出现提示,按照提示修改配置文件即可

 

 

 

3、Redis

redis下载地址:http://windows.php.net/downloads/pecl/snaps/redis/2.2.5/

 

下载地址:http://windows.php.net/downloads/pecl/releases/igbinary/2.0.1/

 

解压文件

redis中的php_redis.dlligbinary中的php_igbinary.dll复制到php的扩展文件ext

配置php添加扩展

;php_redis

extension=php_igbinary.dll

extension=php_redis.dll

注:extension=php_igbinary.dll一定要在extension=php_redis.dll之前

 

D:/php5.6/php-5.6.29/下,安装shift键,单击鼠标右击,单击在此处打开命令窗口

 

重启apache

 

 

4、线程扩展pthreads 安装

pthreads 下载地址:http://windows.php.net/downloads/pecl/releases/pthreads/2.0.8/

 

pthreads 中的php_pthreads.dll,复制到php的扩展文件ext下。将pthreads中的pthreadVC2.dll,复制到php

;php_pthreads

extension=php_pthreads.dll

D:/php5.6/php-5.6.29/下,安装shift键,单击鼠标右击,单击在此处打开命令窗口

 

重启apache

 

 

5、线程测试

<?php

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();

?>

 

6、redis 测试

<?php

$redis = new Redis();

$redis->connect('127.0.0.1',6379);

$redis->set('Jay13','www.jb51.net');

echo 'Jay13:'.$redis->get('Jay13');

echo '</br>';

echo 'Jay12:'.$redis->get('Jay12');

?>

 

7redis软件下载https://redisdesktop.com/download



0 0
原创粉丝点击