今天在windows环境实践了一下php的安装,借鉴网上的资料,步骤如下:1. 下载apache, 地址为 http://archive.apache.org/dist/httpd/binaries/win32/ , 版本apache2.2.17,文件名为:apache_2.2.17-win32-x86-no_ssl.msi,然后安装,一路next,直至完毕。ps:安装时最好按默认的步骤进行安装,如果不熟悉,最好不要用custom方式安装,否则会出现一些莫名其妙的错误!
2. 下载php,官方网为http://php.net/, 版本5.3,文件名:php-5.3.5-Win32-VC6-x86.zip,VC6为apache版php,VC9为IIS版,解压安装,一路next,直至完毕。
3. 修改php的配置,修改php.ini-dist或php.ini-production,更名为php.ini。没特殊要求,可以不要修改这个文件。一般常见的修改点为:
extension_dir = "d:/php/ext"然后根据ext目录里面的dll文件打开扩展包:
; 常用配置 extension=php_curl.dll extension=php_gd2.dll extension=php_mbstring.dll ; 支持Mysql extension=php_mysql.dll extension=php_mysqli.dll extension=php_pdo_mysql.dll extension=php_xmlrpc.dll .. ; 时区设定为中国时区 date.timezone = "Asia/Shanghai"
4. 在环境变量中增加php的变量,在path中增加php的安装路径:D:/php-5.3;D:/php-5.3/ext;
5. 修改apache的配置文件httpd.conf,在httpd.conf中增加对php的环境支持:
#php configuration PHPIniDir "D:/php-5.3" LoadModule php5_module "D:/php-5.3/php5apache2_2.dll" AddType application/x-httpd-php .php #php configuration end修改DocumentRoot "D:/Apache/Apache2.2/htdocs"为想要的路径,比如:DocumentRoot(网站根目录) "D:/phpwork"修改<Directory "D:/Apache/Apache2.2/htdocs">为想要的路径,比如:<Directory "D:/phpwork">修改目录索引DirectoryIndex index.html为
DirectoryIndex index.php index.html6. 在D:/workspace/test/main下新建一文件命名为index.php
<?php echo "hello php!"; ?>
就输出一行字:hello php!,然后运行apache,打开浏览器输入:localhost:80,将打印:hello php
相关资源:【2014】php_memcache.dll 适用于PHP5.3.3版本(wampServer memcache)