PHP安装步骤(以apache 2.2 + php5.3为例)
2010-01-04 11:42
381 查看
1. Download Apache for windows MSIfile, and run it
Bydefault, port is 80, root dir is %apache_dir%/htdocs. You can update thesettings in conf/httpd.conf file
2. If Apache Service can't be installed in "Control Panel > Admin Tools > Services",
Execute following command in %apache_dir%/bin
httpd.exe -k install -n Apache2.2
另外几个有用的命令:
remove apache service:
start apache service from :
stop apache service:
restart apache service:
如果不通过windows Apache service,你可以直接使用下列命令:
start apache server: httpd
stop apache server:
restart apache server:
2. Test if apache server works
1) Start server: start “Apacheservice” from “Control Panel > select “Start > Programs >
Apache httpserver 2 > control apache server > start” or start server from apacheserver icon in the right bottom corner of desktop
For Win 7,上述方法都无法启动apache server,你需要rightclick右下角的apache
icon,然后select “open services”,然后start“apache server” service
2) Try to accesshttp://localhost
3. Download and extract php5.3 zipfile
Note: download php 5.3 VC9 thread safe version
4. 进入 php的安装目录,将php.ini-production或php.ini-development复制一份,命名为
php.ini。
Assume php install dir is “d:/php5”
5. Configure PHP in php.ini file
1) Find
extension_dir = "./"
Change it to following
extension_dir = "d:/php5/ext"
IF there is "#" before above code, MUST REMOVE IT!!!!!!!!!!!!!!
php can’tfind extension module without it
2) To support mysql, remove “;”fromfollowing line
;extension=php_mysql.dll
if php load mysql module successfully, you can see "mysql" module (NOT "mysqlnd" module) in phpinfo()
To Support openssl, remove ";" from following line (phplist with gmail setting must use openssl)
;extension=php_openssl.dll
if php load mysql module successfully, you can see "openssl" module in phpinfo()
3) (Optional)To enable short open tags(for example <? ...?>), find “short_open_tag”setting
and change it tofollowing:
short_open_tag = On
4) (Optional)To display errormessages in your browser window for development, find “display_errors”settingand
change it to following:
display_errors = On
6. Configure Apache for PHP 5
Open%apache_dir%/conf/httpd.conf file,
1) Add php module
If usingApache 2.0.x, add following line after all the LoadModule statements:
LoadModulephp5_module "d:/php5/php5apache2.dll"
If usingApache 2.2.x, add the following line instead:
LoadModulephp5_module "d:/php5/php5apache2_2.dll"
注意:使用的是“/”,而不是“/”
2) Add php type
Searchfor "AddType" in the file, and add the following line after the last"AddType" statement
AddTypeapplication/x-httpd-php .php
AddTypeapplication/x-httpd-php .phtml
3) Indicate the location folder ofyour PHP ini file
Add the following line to the end of your httpd.conf file.
PHPIniDir"d:/php5"
注意:使用的是“/”,而不是“/”
4) Find “DirectoryIndex” setting,and change it to
DirectoryIndex index.php index.html
5) Save httpd.conf file and restartapache server
7. Create a test.php file in rootpath, the content is following:
<?php phpinfo();?>
Tryit fromhttp://localhost/test.php
注意:不再需要在环境变量“path”里添加php的安装目录
Bydefault, port is 80, root dir is %apache_dir%/htdocs. You can update thesettings in conf/httpd.conf file
2. If Apache Service can't be installed in "Control Panel > Admin Tools > Services",
Execute following command in %apache_dir%/bin
httpd.exe -k install -n Apache2.2
另外几个有用的命令:
remove apache service:
httpd.exe -k uninstall -n Apache2.2
start apache service from :
httpd.exe -k start
stop apache service:
httpd.exe -k stop or
httpd.exe -k shutdown
restart apache service:
httpd.exe -k restart
如果不通过windows Apache service,你可以直接使用下列命令:
start apache server: httpd
stop apache server:
httpd.exe -k shutdown
restart apache server:
httpd.exe -k restart
2. Test if apache server works
1) Start server: start “Apacheservice” from “Control Panel > select “Start > Programs >
Apache httpserver 2 > control apache server > start” or start server from apacheserver icon in the right bottom corner of desktop
For Win 7,上述方法都无法启动apache server,你需要rightclick右下角的apache
icon,然后select “open services”,然后start“apache server” service
2) Try to accesshttp://localhost
3. Download and extract php5.3 zipfile
Note: download php 5.3 VC9 thread safe version
4. 进入 php的安装目录,将php.ini-production或php.ini-development复制一份,命名为
php.ini。
Assume php install dir is “d:/php5”
5. Configure PHP in php.ini file
1) Find
extension_dir = "./"
Change it to following
extension_dir = "d:/php5/ext"
IF there is "#" before above code, MUST REMOVE IT!!!!!!!!!!!!!!
php can’tfind extension module without it
2) To support mysql, remove “;”fromfollowing line
;extension=php_mysql.dll
if php load mysql module successfully, you can see "mysql" module (NOT "mysqlnd" module) in phpinfo()
To Support openssl, remove ";" from following line (phplist with gmail setting must use openssl)
;extension=php_openssl.dll
if php load mysql module successfully, you can see "openssl" module in phpinfo()
3) (Optional)To enable short open tags(for example <? ...?>), find “short_open_tag”setting
and change it tofollowing:
short_open_tag = On
4) (Optional)To display errormessages in your browser window for development, find “display_errors”settingand
change it to following:
display_errors = On
6. Configure Apache for PHP 5
Open%apache_dir%/conf/httpd.conf file,
1) Add php module
If usingApache 2.0.x, add following line after all the LoadModule statements:
LoadModulephp5_module "d:/php5/php5apache2.dll"
If usingApache 2.2.x, add the following line instead:
LoadModulephp5_module "d:/php5/php5apache2_2.dll"
注意:使用的是“/”,而不是“/”
2) Add php type
Searchfor "AddType" in the file, and add the following line after the last"AddType" statement
AddTypeapplication/x-httpd-php .php
AddTypeapplication/x-httpd-php .phtml
3) Indicate the location folder ofyour PHP ini file
Add the following line to the end of your httpd.conf file.
PHPIniDir"d:/php5"
注意:使用的是“/”,而不是“/”
4) Find “DirectoryIndex” setting,and change it to
DirectoryIndex index.php index.html
5) Save httpd.conf file and restartapache server
7. Create a test.php file in rootpath, the content is following:
<?php phpinfo();?>
Tryit fromhttp://localhost/test.php
注意:不再需要在环境变量“path”里添加php的安装目录
相关文章推荐
- win7安装 Apache2.2 PHP5.3 MySQL5.6
- Windows系统上使用Apache2.2上模块化安装PHP5.3
- Windows系统上使用Apache2.2上模块化安装PHP5.3
- Apache2.2 + PHP5.3 + MySQL5.5安装指南
- win7 PHP5.3 apache2.2 安装redis不行???????????
- 【转】给Windows + Apache 2.2 + PHP 5.3 安装PHP性能测试工具 xhprof
- win7 下 apache2.2 + php5.3 + mysql5.5安装php环境 + phpMyAdmin
- php5.3 apache2.2安装配置
- centos6.5中用yum方式安装php5.4与apache2.2的步骤
- 给Windows + Apache 2.2 + PHP 5.3 安装PHP性能测试工具 xhprof_0.10.3_php53_vc9.dll
- windows下安装apache2.2,php5.3
- 安装Moodle2.2步骤--在LAMP环境(linux+apache+mysql+php)
- php5.3 apache2.2 mysql安装配置
- centOs5.3 安装apache+tomcat+php+mysql
- 八个步骤完成Apache, PHP, 和MySQL在Windows下的安装
- windows7下手工搭建Apache2.2 php5.3 Mysql5.5开发环境
- php5.3.1和Apache2.2安装配置问题
- Apache2.2_php5.3 配置成功
- Centos下mysql,apache,php安装详细步骤(redis+memcache+APC)
- 第一次安装配置 Apache2.2 + PHP5.4.3(win7)