• Apache PHP 服务环境配置


    参考网上的经验,并以自己的实践为基础,整理出以下内容:

     

    Apache2.2:httpd-2.2.25-win32-x86-openssl-0.9.8y.msi

    http://httpd.apache.org/download.cgi#apache24

     

    PHP5.2:php-5.2.17-Win32-VC6-x86.zip

    http://windows.php.net/download/

     

    说明:Apache和PHP版本匹配很重要,Apache2需使用VC6版本的PHP。

    以下说明摘自网页http://windows.php.net/download/的左侧的Which version do I choose?的说明:

    If you are using PHP with Apache 1 or Apache2 fromapache.org (not recommended) you need to use the older VC6 versions of PHP compiled with the legacy Visual Studio 6 compiler. Do NOT use VC9+ versions of PHP with the apache.org binaries.

     

    第一:安装并配置APACHE(以我的为例,安装到D:Program FilesApache Software FoundationApache2.2)

    1.安装时默认安装,Network Domain、Server Name 任意填个名字,Administrator's Email Address区域填你的邮件地址。

    2.安装完后在安装目录下有个conf文件夹,打开httpd.conf文件进行配置。

    2.1找到 DocumentRoot,将其设置为你所要存放php, htm等网页文件的文件夹,如 "D:/Program Files/Apache Software Foundation/Apache2.2/htdocs"。

    2.2找到Directory,设置为与DocumentRoot相同的目录。

    2.3找到 DirectoryIndex ,设置访问IP地址时默认打开的网页,当有多个设置时,以单个空格将其分开,优先级从左到右递减。

    2.4重启Apache,用http://localhost/或http://127.0.0.1 /测试是否成功。成功的话屏幕会有个It works!

    设置Apache可参考:http://www.dedecms.com/knowledge/servers/apache-iis/2009/1014/1074.html

     

    第二:安装配置PHP(解压PHP压缩包到D:Program FilesPHP_5.2

    1.将php.ini-recommended文件重命名为php.ini。

    2.将extension_dir 改为php/ext所在目录,如 " D:/Program Files/PHP_5.2/ext";

    3.将doc_root 改为第一步中的同样目录,如 "D:/Program Files/Apache Software Foundation/Apache2.2/htdocs";

    4.找到 ;session.save_path = "/tmp" ,将';'去掉,设置你保存session的目录,如session.save_path = " D:/Program Files/PHP_5.2/session_temp";

    5.然后把下面几句前面的分号去掉,以更好支持Mysql and PHPmyadmin

    extension=php_mbstring.dll

    extension=php_gd2.dll

    extension=php_mysql.dll

    extension=php_mysqli.dll 

     

    第三:将PHP作为Apache的一个模块来运行

    1.打开httpd.conf,添加下面内容(位置任意,建议放在LoadModule列表下,方便查看):

    LoadModule php5_module "D:/Program Files/PHP_5.2/php5apache2_2.dll"

    AddType application/x-httpd-php .php

    AddType application/x-httpd-php .htm

    PHPIniDir "D:/Program Files/PHP_5.2"

     

    第四:重启Apache,浏览器中输入http://localhost/或http://127.0.0.1 /,默认打开DirectoryIndex指定的网页。

    1.若启动Apache报错,可以用命令行模式启动apache,并带上参数,apache会提示你哪句有误,然后就可以针对性的解决,命令如下: httpd.exe -w -n "Apache2.2" -k start

     

    若遇到加载mysql模块失败时:

    (失败详细信息可查看D:Program FilesApache Software FoundationApache2.2logs error.log)

    PHP Warning: PHP Startup: Unable to load dynamic library 'D:\Program Files\PHP_5.2\ext\php_mysql.dll' - xd5xd2xb2xbbxb5xbdxd6xb8xb6xa8xb5xc4xc4xa3xbfxe9xa1xa3 in Unknown on line 0

    PHP Warning: PHP Startup: Unable to load dynamic library 'D:\Program Files\PHP_5.2\ext\php_mysqli.dll' - xd5xd2xb2xbbxb5xbdxd6xb8xb6xa8xb5xc4xc4xa3xbfxe9xa1xa3 in Unknown on line 0

    解决方法:

    拷贝D:Program FilesPHP_5.2libmysql.dll 到 D:Program FilesApache Software FoundationApache2.2in

    http://blog.csdn.net/baidongli/article/details/6285565

     

    apache启动报错:the requested operation has failed解决办法

    http://blog.csdn.net/dhdhdh0920/article/details/4364473

     

    此类设置也可参考:

    http://tech.163.com/06/0206/11/299AMBLT0009159K_2.html

  • 相关阅读:
    Cannot find a free socket for the debugger
    如何让myeclipse左边选中文件后自动关联右边树
    myeclipse反编译安装 jd-gui.exe下载
    MyEclipse报错Access restriction: The type BASE64Encoder is not accessible due to restriction on required library
    如何使用JAVA请求HTTPS
    如何使用JAVA请求HTTP
    SVN提交代码时报405 Method Not Allowed
    对称加密和非对称加密
    ORA-12505, TNS:listener does not currently know of SID given in connect descriptor
    调整Linux操作系统时区-centos7
  • 原文地址:https://www.cnblogs.com/ant-wjf/p/3308548.html
Copyright © 2020-2023  润新知