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

本文详细介绍了如何在Windows上配置PHP5.6、Apache2.4,并集成Redis和pthreads线程扩展。通过下载相应软件包,配置php.ini和httpd.conf文件,以及添加和启用扩展,最终实现Redis的测试和线程操作。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

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



评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值