安裝網絡服務器在Windows XP與Apache2、PHP5和MySQL4 -第3部分

第3部分-安裝PHP 5

拉開下載的PHP郵編包裹拉鏈 第1部分 對C:\PHP (創造一個新的文件夾被命名PHP在C:\根水平)。 然後關閉Apache Server。

打開亞帕基印第安人httpd.conf用文本編輯程序并且增加二個代碼行:

LoadModule php5_module C :/php/php5apache2.dll
AddType application/xhttpdphp .php

增加的.php引伸到展示如何解析.php文件

也注意目錄在裝載模塊點對,在哪裡我們安裝PHP。 如此,如果您安裝PHP在其他地點,相應地改變它。 目錄樣式太應該是/而不是共同的DOS \。

這二條線可以增加到httpd.conf文件的底部。 然而,注意模塊在裝載名單按反向優先權順序; 來最新罐頭代理佣金或先佔有及早被列出的那些的那些。 所以,增加php_mod在結尾的名單可能有意想不到的結果,例如使失去能力的mod_rewrite (和其他模塊)為存在的所有php文件(mod_rewrite優良將跑,如果文件不存在)。 同一個錯誤可能使mod_auth和其他重要模塊失去能力。 總之,應該裝載php_mod,在您希望跑的任何模塊之前,在您的php代碼被執行之前。 看筆記在 亞帕基印第安人AddModule文獻 為怎樣發現被推薦的命令。

其次,拷貝或漿糊「php.ini推薦了」給C :/Program文件或亞帕基印第安人小組或者Apache2 (或您的亞帕基印第安人設施道路),和給它改名對php.ini。 重新開始Apache Server。

測試的php5設施

創造一個文件與以下內容并且保存它對根網文件夾(C :/Server/htdocs或缺省C :/Program文件或亞帕基印第安人小組或者Apache2/htdocs/)作為「php5info.php」。

<?php
phpinfo ();
?>

訪問以下URL http://localhost/php5_info.php. 在瀏覽器應該顯示完全PHP設置。 如果錯誤或沒什麼顯示,有問題與設施。 再試一次安裝程序。

使能MySQL引伸

從php.ini被推薦的已經被設置複製到最宜的設置的php.ini,那麼那裡是沒有特別需要編輯它。 然而,它仍然需要編輯使能mysql引伸。

打開php.ini在Apache2目錄用文本編輯程序。

查尋線 extension_dir = 「。/」. 改變它 extension_dir = 「C:\php5\ext」. 並且, uncomment線 extension=php_mysql.dll.

保存php.ini。 重新開始Apache Server。 再試到通入 http://localhost/php5_info.php. 它應該優良工作。 If not try to check what’s the cause of errors, which most likely due to wrong extension_dir or missing extension. Or you may try to copy all the needed extentions (with .dll extenstion) to Apache2 directory.

IMPORTANT: You're reading a machine translated page which is provided "as is" without warranty. Unlike human translation, machine translation does not understand the grammar, semantics, syntax, idioms of natural language, thus often produce inaccurate and low quality text which is misleading and incomprehensible. Thus, please refer to original English article whenever possible.

MDL blog postings now continue at Tip and Trick, and readers are welcome to join My Digital Life Forums.


13 Responses to “Install Web Server in Windows XP with Apache2, PHP5 and MySQL4 - Part 3”

  1. Todd
    May 20th, 2006 03:42
    1

    well, I have followed your directions and everyone else’s before this, but no luck. After adding the module declaration in the httpd.conf file, when I restart apache i get - syntax error: cannot load specific module. all of my paths are correct what is the problem?

  2. Administrator
    May 20th, 2006 14:33
    2

    Hi Todd, the issue might be related to mod_perl (if you’re using it as ActivePerl). If you install Apache/2.2, please use mod_perl that is compiled with Apache 2.2 and not Apache 2.0 for compatibility issue.

  3. greg
    July 12th, 2006 19:10
    3

    I have the server set up and i can read a php file if i start it withhtml tags but it doesnt read the php script i put in. if i dont use the html tags i get a download box when i click on the link to test the php?? can u help me!!

  4. Administrator
    July 12th, 2006 19:46
    4

    Looks like your web server doesn’t parse PHP file and treat it as text file, follow the steps carefully.

  5. greg
    July 13th, 2006 07:32
    5

    ok i reset it and now the server cannot find php5apache2.dll? It is in the php folder. I am using php5.1.4 and apache2.2.2!

  6. greg
    July 13th, 2006 08:43
    6

    I got it to work i uninstalled apache 2.2 and installed 2.0 and followed your steps again and now it is all working:)

    Thank you for the help!

  7. Tom
    September 10th, 2006 20:48
    7

    There seems to be a problem with Apache 2.2 and the PHP dll modules (on Windows obviously, don’t know if there are any problems on unix). I fixed it by going to http://www.apachelounge.com/download/ and downloading their version of the php4apache2.dll file. This also comes with another file which you have to put in your Apache/bin directory, and you will also need to download a MS Visual C++ Package if you don’t have the .NET framework installed. This is all explained in the readme file that comes with the DLL.

  8. cary
    October 7th, 2006 07:18
    8

    With Apache 2.2, you will need PHP 5.2.x. It has the php5apache2_2.dll that is compiled for the new version. You can download a stable build at http://snaps.php.net/

  9. JaD
    February 19th, 2007 17:11
    9

    You said…

    Search for the line of extension_dir = “./”. Change it to extension_dir = “C:\php5\ext”. Also, uncomment the line of extension=php_mysql.dll.

    Save the php.ini. Restart the Apache server. Re-try to access http://localhost/php5_info.php. It should working fine. If not try to
    …..
    …..
    “C:\php5\ext”. ?????? — the correct line is
    “C:\php\ext”.

  10. JaD
    February 19th, 2007 17:23
    10

    u forgot a thing, for the apache..
    modify DirectoryIndex and put index.php
    in rest is a good tutorial :P

  11. Asokan
    February 25th, 2007 01:30
    11

    I am trying to connect mysql5 from apache2 but
    browser showing an error

    Warning: require(/config/db_config.php) [function.require]: failed to open stream: No such file or directory in C:\webroot\dbconnect.php on line 2

    Fatal error: require() [function.require]: Failed opening required ‘/config/db_config.php’ (include_path=’.;C:\php5\pear’) in C:\webroot\dbconnect.php on line 2

    I am using,MySQL5, PHP5 and Apache2.2 running windows xp
    Request your help
    Thanking you
    ******

  12. Asokan
    February 25th, 2007 01:30
    12

    I am trying to connect mysql5 from apache2 but
    browser showing an error

    Warning: require(/config/db_config.php) [function.require]: failed to open stream: No such file or directory in C:\webroot\dbconnect.php on line 2

    Fatal error: require() [function.require]: Failed opening required ‘/config/db_config.php’ (include_path=’.;C:\php5\pear’) in C:\webroot\dbconnect.php on line 2

    I am using,MySQL5, PHP5 and Apache2.2 running windows xp
    Request your help
    Thanking you
    Asokan

  13. Handril
    June 21st, 2007 13:10
    13

    I have succes install apache 2, php5 and MySQL 5. I can display php info. But, why php script that I make can not run in the IE browser. this simple script like this:

    I use Windows XP.

    Thank you for your attention.

Leave a Reply

You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

Subscribe without commenting



Incoming Search Terms for the Article

error trying access httpd.conf file - error trying access httpd.conf - error trying to access httpd.conf - error trying to access httpd.conf file - error trying access httpd.conf file. you will need to manually configure the web server - php5 apache2 windows - php error trying access httpd.conf file - установка php на windows - apache php module - php "error trying access httpd.conf file" "manually configure" - PHP install error error trying access httpd.conf file - apache2.2 php5 - how to install a server and php on windows xp - php error trying access httpd.conf - windows apache php5 - download php_mysql.dll - php cannot run on apache - php5 apache2.2 config - Error trying access httpd.conf file. You will need to manually configure the web server. - error trying access httpd.conf file when download php - install php5 apache xp - php5 apache2 - "error trying to access httpd.conf" php installer - Apache2 PHP5 - php error trying to access httpd.conf - php5 apache2.2 - php 5 apache 2.2 install not parsing files windows - error trying access httpd.conf file. - httpd.conf access error, php install - php5+apache2 - error trying access to httpd.conf php installation - installing php5 on apache2 win - php apache2.2 - php5 for apache2 - apache server cannot read .php files - php5 with apache2.2 - php y apache en windows xp - php5 apache problema - как включить php в apache2 - установка Apache2.2 и PHP5 на XP - apache2 c:/php/php5apache2.dll - apache 2.2 windows install php - error trying access httpd.conf file. you will need to manually configue the web server - how to install apache2.2 server on windows - Error trying access httpd.conf file. You will need to manually configure the web server. - mysql extension error in Windows XP - php5 vista error trying access httpd.conf - php windows install "httpd.conf" "cannot load" - apache2.2 php5 windows installation problems - apache loadmodule php windows -