標籤:blog http io art for re
Senario
Yii2 架構開始要求 PHP 版本在 PHP 5.4.0 之上
eg. yii2 中用到這樣的代碼 php 5.3.5 就不支援
$extension = ['name' => $package->getName(),'version' => $package->getVersion(),];
Download & Install PHP5.4 for Windows
window php-5.4.0 之後不再支援 VC6 的編譯包, 只下載到了 VC9 的編譯包。
php5.4 [VC9] 在 VC6 環境中安裝
win下的apache是用VC6編譯的,其外掛程式(apache module)也必須用VC6編譯。
PHP5.4為什麼不支援VC6?因為VC6太舊了,1998年的工具..
不能用是指php以apache mod的方式不能用。
現在php都以fast-cgi的方式掛載支援apache,連微軟iis都放棄isapi轉採用fast-cgi了。
在不同的進程下,VC9的php fast-cgi通過進程間通訊支援apache,即使apache不是vc不是win版都沒問題。
去下載apache的mod_fcgid,然後把php配置到fcgid上。就可以用了
Download php-5.4.30
From http://windows.php.net/downloads/releases/php-5.4.30-Win32-VC9-x86.zip
- extract
.zip
file into C:\php5.4
- copy php.ini-production php.ini
modify C:\php5.4\php.ini
php.ini
; Directory in which the loadable extensions (modules) reside.; http://php.net/extension-dir; extension_dir = "./"; On windows:; extension_dir = "ext" extension_dir = "C:\php5.4\ext
download mod_fcgid-2.3.6-win32-x86.zip
From http://www.apache.org/dist/httpd/binaries/win32/
- extract mod_fcgid.so into C:\Apache2.2\modules
modify C:\Apache2.2\conf\httpd.conf
httpd.conf
#LoadModule cgi_module modules/mod_cgi.soLoadModule fcgid_module modules/mod_fcgid.s#php-5.4.30-Win32-VC9-x86#BEGIN PHP INSTALLER EDITS - REMOVE ONLY ON UNINSTALLPHPIniDir "C:/php5.4/"LoadModule php5_module "C:/php5.4/php5apache2_2.dll"#END PHP INSTALLER EDITS - REMOVE ONLY ON UNINSTAL
(原創文章 http://www.cnblogs.com/ganiks/)[http://www.cnblogs.com/ganiks/]
Restart ApacheCheck your version
Check apache_php version and php console version
- echo phpinfo(); to check
- open a cmd window, ‘php -v‘ to check
enable php_memcache.dll
Keep an eye on the version, otherwise you can‘t restart apache normally
load 正確版本的 php_memcache.dll
My environment:
Thread Safety enabled
Compiler MSVC9 (Visual C++ 2008)
Architecture x86
Loaded Configuration File C:\php5.4\php.ini
PHP Version 5.4.30
http://windows.php.net/downloads/pecl/releases/memcache/3.0.8/
Tuesday, October 22, 2013 2:19 AM 182281 php_memcache-3.0.8-5.4-ts-vc9-x86.zip
當然,之前有些老的項目在 PHP5.4 之下支援也不是很好,比如 split
函數在 5.4 中就不支援。
php5.3 php5.4 之間切換
- apache web端: reconfig httpd.conf
- cmd console端: reconfig computer $PATH