首页 php教程 php手册 PHP安装步骤(以apache 2.2 + php5.3为例)

PHP安装步骤(以apache 2.2 + php5.3为例)

Jun 06, 2016 pm 07:59 PM
apache php 安装 步骤

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, Ex

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:      httpd.exe -k uninstall -n Apache2.2

            start apache service from : httpd.exe -k start

            stop apache service:           httpd.exe -k stop    orhttpd.exe -k shutdown

            restart apache service:       <span>httpd.exe -k restart</span>

 

      如果不通过windows Apache service,你可以直接使用下列命令:

            start apache server:          httpd

            stop apache server:       <span>httpd.exe -k shutdown</span>     

            restart apache server:       <span>httpd.exe -k restart</span>

 


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-productionphp.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:

Tryit fromhttp://localhost/test.php

 

注意:不再需要在环境变量“path”里添加php的安装目录

 

 

 

 

本站声明
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系admin@php.cn

热AI工具

Undresser.AI Undress

Undresser.AI Undress

人工智能驱动的应用程序,用于创建逼真的裸体照片

AI Clothes Remover

AI Clothes Remover

用于从照片中去除衣服的在线人工智能工具。

Undress AI Tool

Undress AI Tool

免费脱衣服图片

Clothoff.io

Clothoff.io

AI脱衣机

Video Face Swap

Video Face Swap

使用我们完全免费的人工智能换脸工具轻松在任何视频中换脸!

热工具

记事本++7.3.1

记事本++7.3.1

好用且免费的代码编辑器

SublimeText3汉化版

SublimeText3汉化版

中文版,非常好用

禅工作室 13.0.1

禅工作室 13.0.1

功能强大的PHP集成开发环境

Dreamweaver CS6

Dreamweaver CS6

视觉化网页开发工具

SublimeText3 Mac版

SublimeText3 Mac版

神级代码编辑软件(SublimeText3)

PHP的目的:构建动态网站 PHP的目的:构建动态网站 Apr 15, 2025 am 12:18 AM

PHP用于构建动态网站,其核心功能包括:1.生成动态内容,通过与数据库对接实时生成网页;2.处理用户交互和表单提交,验证输入并响应操作;3.管理会话和用户认证,提供个性化体验;4.优化性能和遵循最佳实践,提升网站效率和安全性。

PHP和Python:解释了不同的范例 PHP和Python:解释了不同的范例 Apr 18, 2025 am 12:26 AM

PHP主要是过程式编程,但也支持面向对象编程(OOP);Python支持多种范式,包括OOP、函数式和过程式编程。PHP适合web开发,Python适用于多种应用,如数据分析和机器学习。

PHP和Python:代码示例和比较 PHP和Python:代码示例和比较 Apr 15, 2025 am 12:07 AM

PHP和Python各有优劣,选择取决于项目需求和个人偏好。1.PHP适合快速开发和维护大型Web应用。2.Python在数据科学和机器学习领域占据主导地位。

在PHP和Python之间进行选择:指南 在PHP和Python之间进行选择:指南 Apr 18, 2025 am 12:24 AM

PHP适合网页开发和快速原型开发,Python适用于数据科学和机器学习。1.PHP用于动态网页开发,语法简单,适合快速开发。2.Python语法简洁,适用于多领域,库生态系统强大。

为什么要使用PHP?解释的优点和好处 为什么要使用PHP?解释的优点和好处 Apr 16, 2025 am 12:16 AM

PHP的核心优势包括易于学习、强大的web开发支持、丰富的库和框架、高性能和可扩展性、跨平台兼容性以及成本效益高。1)易于学习和使用,适合初学者;2)与web服务器集成好,支持多种数据库;3)拥有如Laravel等强大框架;4)通过优化可实现高性能;5)支持多种操作系统;6)开源,降低开发成本。

PHP:处理数据库和服务器端逻辑 PHP:处理数据库和服务器端逻辑 Apr 15, 2025 am 12:15 AM

PHP在数据库操作和服务器端逻辑处理中使用MySQLi和PDO扩展进行数据库交互,并通过会话管理等功能处理服务器端逻辑。1)使用MySQLi或PDO连接数据库,执行SQL查询。2)通过会话管理等功能处理HTTP请求和用户状态。3)使用事务确保数据库操作的原子性。4)防止SQL注入,使用异常处理和关闭连接来调试。5)通过索引和缓存优化性能,编写可读性高的代码并进行错误处理。

PHP和Python:深入了解他们的历史 PHP和Python:深入了解他们的历史 Apr 18, 2025 am 12:25 AM

PHP起源于1994年,由RasmusLerdorf开发,最初用于跟踪网站访问者,逐渐演变为服务器端脚本语言,广泛应用于网页开发。Python由GuidovanRossum于1980年代末开发,1991年首次发布,强调代码可读性和简洁性,适用于科学计算、数据分析等领域。

PHP的影响:网络开发及以后 PHP的影响:网络开发及以后 Apr 18, 2025 am 12:10 AM

PHPhassignificantlyimpactedwebdevelopmentandextendsbeyondit.1)ItpowersmajorplatformslikeWordPressandexcelsindatabaseinteractions.2)PHP'sadaptabilityallowsittoscaleforlargeapplicationsusingframeworkslikeLaravel.3)Beyondweb,PHPisusedincommand-linescrip

See all articles