Home  >  Article  >  Backend Development  >  php 在windows下编译安装dll文件

php 在windows下编译安装dll文件

WBOY
WBOYOriginal
2016-07-28 08:29:121875browse

本文会记录到以下内容:

1、Visual C++ 2008 对php干啥的

   Apache启动时无法加载php5apache2_2.dll解决办法
   这个组件包是应用软件一起发布给最终用户的软件包,用户只要安装这个和你的应用程序,即可运行你制作的应用。
   你用VC++2008编制的应用程序,编译链接生成可执行文件后, 要想在没有安装VC++2008的电脑上允许,就需要这个软件包。
   目前php.net的php二进制源码都是x86版本,从压缩包和安装文件的命名就可以看出,所以一般下载x86版本的c++2008运行时环境就行了。

2、vcredist_x86干嘛的

   安装apache需要VC10 SP1 vcredist_x86.exe,如果你遇到无法安装apache的情况,下载安装它。

   vcredist_x86.exe是针对于不同CPU所出的优化补丁执行程序,是一种基于C++的软件需要的库文件,有些程序在安装相应的vcredist文件环境下才能运行。

   目前 vcredist_x86.exe多用做于winxp等基于x86平台的系统补丁。因此也不支持在VISTA系统下安装。

   玩游戏一般都会碰到这种情况没事的 你放心下一个安装上就可以

3、php在window下安装pthread.dll文件主要条件和安装方法并使用。

       条件:

   php5.3或以上,且为线程安全版本。apache和php使用的编译器必须一致。
   通过phpinfo()查看Thread Safety为enabled则为线程安全版。
   通过phpinfo()查看Compiler项可以知道使用的编译器。本人的为:MSVC9 (Visual C++ 2008)。

   下载安装pthreads.dll文件http://windows.php.net/downloads/pecl/releases/pthreads

   找到符合你要安装的版本:比如

    php_pthreads-2.0.9-5.4-ts-vc9-x86.zip

   其中5.4代表你的php版本,ts说明是线程安全,vc9-x86代表编译器版本

   将其中的php_pthreads.dll复制到php的ext文件夹下,并开启php.ini扩展 。extension=php_pthreads.dll

   将pthreadVC2.dll 的目录放到环境变量或者在Apache中加载该文件。

测试pthreads

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

输出helloWorld 为成功。测试一下使用多线程for循环和单单for循环。循环数越大 两者上的时间差距还是很明显的

以上就介绍了 php 在windows下编译安装dll文件,包括了方面的内容,希望对PHP教程有兴趣的朋友有所帮助。

Statement:
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 [email protected]