Longhorn PHP 2019 Schedule

## 在 Windows 上安装 PHP 扩展

### 去哪里找扩展库？

PHP 扩展库通常称为“php_*.dll”（其中星号代表具体某扩展的名字），位于“PHP\ext”目录下（在 PHP 4 中位于“PHP\extensions”目录下）。

PHP 发行包中包括了大多数开发者最常用到的扩展库。这些被称为“核心”扩展库。

### 下载哪个扩展？

• 不同的版本号（至少前两个数字要一致）
• 不同的线程安全性设定
• 不同的处理器体系（x86，x64，...)
• 不同的排错设定
• 其它

Example #1 phpinfo() call

 <?phpphpinfo();?> 

drive:\\path\to\php\executable\php.exe -i


### 载入一个扩展

;extension=php_extname.dll

extension=php_extname.dll


Configuration File (php.ini) Path  C:\WINDOWS

Loaded Configuration File   C:\Program Files\PHP\5.2\php.ini


### 解决问题

 For Windows try setting the  extension_dir set to a complete path if you have an error. Only having extension_dir ="ext" did not work for me. The Apache error log showed it looking for ext\\<extension.dll> and unable to find it.; Directory in which the loadable extensions (modules) reside.; http://php.net/extension-dir; extension_dir = "./"; On windows:extension_dir = "C:\php\ext" 
 In xampp. After removing the semicolon from the php.ini file, I had to stop the the apache server from the xampp GUI and restart it. Then I used the following code to view all the loaded extentions and my extension was shown there as well.print_r(get_loaded_extensions());Hope this helps! 
 To create a dll extension to PHP follow this instructions: http://blog.slickedit.com/2007/09/creating-a-php-5-extension-with-visual-c-2005/ *****IMPORTANT 1)You MUST use the last release of PHP source code, or people will not me able to use your extension. Don't worry to use only the version of the tutorial. 2) The folder "regex" exists in PHP 5.3, just find it in the subfolders. 3)While building your dll in Visual Studio, if you have any problem compiling or linking like: "winsock2.h is missing", find the files on your computer and include the project in the same way that the tutorial taught.