downloads | documentation | faq | getting help | mailing lists | licenses | wiki | reporting bugs | php.net sites | links | conferences | my php.net

search for in the

Sun, iPlanet and Netscape servers on Microsoft Windows> <Apache 1.3.x on Microsoft Windows
Last updated: Fri, 24 Jul 2009

view this page in

마이크로소프트 윈도우에서 Apache 2.0.x

이 섹션은 마이크로소프트 윈도우 시스템에서 아파치 2.0.x에 PHP 설치에 관한 정보와 힌트를 가지고 있습니다. 아파치 1.3.x 사용자를 위한 지시와 정보는 별도 페이지에 존재합니다.

Note: 수동 설치 단계를 먼저 읽어야 합니다!

Note: 아파치 2.2.x 지원
아파치 2.2.x 사용자는 해당하는 DLL 파일이 php5apache2_2.dll이고, PHP 5.2.0부터 존재한다는 점을 생각하고 아래 문서를 사용해야 합니다. » http://snaps.php.net/를 참고하십시오.

Warning

제품 환경에서 아파치 2 쓰레드 MPM 사용을 권하지 않습니다. prefork MPM을 사용하거나, Apache 1을 사용하십시오. 이유는 관련 FAQ 아파치2 쓰레드 MPM 사용하기를 읽어보십시오.

아파치 2.0.x 서버에 대한 이해를 위하여 » 아파치 문서를 읽기를 권합니다. 또한, 아파치 2.0.x에 대한 » 윈도우 특정 노트도 읽어보십시오.

Note: PHP와 아파치 2.0.x 호환 노트
다음 버전의 PHP가 최신 버전의 아파치 2.0.x에서 작동합니다:

위 PHP 버전은 아파치 2.0.40 이후에 호환됩니다.
아파치 2.0 SAPI 지원은 PHP 4.2.0부터 시작했습니다. PHP 4.2.3은 아파치 2.0.39에서 작동하며, PHP 4.2.3과 다른 아파치 버전을 사용하지 마십시오. 그러나, 권장하는 설정은 최신 버전의 아파치2와 PHP 4.3.0 이후를 사용하는 것입니다.
언급한 모든 PHP 버전은 아파치 1.3.x에서 잘 동작합니다.

Warning

아파치 2.0.x는 윈도우 NT 4.0, 윈도우 2000, 윈도우 XP에서 실행하도록 설계되었습니다. 현 시점에서, 윈도우 9x 지원은 미완성입니다. 아파치 2.0.x는 아직 이러한 플랫폼에서 작동한다는 보장이 없습니다.

가장 최신 버전의 » 아파치 2.0.x와 적합한 PHP 버전을 받으십시오. 수동 설치 단계에 따르고 PHP와 아파치 통합을 진행하십시오.

윈도우에서 아파치 2.0.x에 PHP를 설치하는 방법은 두 가지가 있습니다. 하나는 CGI 바이너리이고, 다른 하나는 아파치 모듈 DLL입니다. 두 방법 모두 httpd.conf를 수정하여 아파치에서 PHP를 작동하도록 하고 서버를 재시작 해야 합니다.

Note: 윈도우 상에서 아파치 설정 파일에 경로값을 추가할 때는 다음과 같이 모든 백슬래시를 슬래시로 바꿔야 합니다: c:\directory\file.extc:/directory/file.ext로 바꿉니다. 디렉토리에는 마지막에 슬래시를 붙여줘야 합니다.

CGI 바이너리로 설치

CGI 바이너리로 설치하려면 아래 세 줄을 아파치 httpd.conf 설정 파일에 넣어야 합니다:

Example #1 CGI로 PHP와 아파치 2.0

ScriptAlias /php/ "c:/php/"
AddType application/x-httpd-php .php

# For PHP 4
Action application/x-httpd-php "/php/php.exe"

# For PHP 5
Action application/x-httpd-php "/php/php-cgi.exe"

Warning

CGI 설정을 사용할 때, 서버가 여러 공격에 노출됩니다. 그러한 공격을 막기 위해 CGI 보안 섹션을 읽어보십시오.

아파치 모듈로 설치

아파치 2.0에 PHP 모듈을 설치하려면 아래 두 줄을 아파치 httpd.conf 설정 파일에 넣어야 합니다:

Example #2 모듈로 PHP와 Apache 2.0

# For PHP 4 do something like this:
LoadModule php4_module "c:/php/php4apache2.dll"
# Don't forget to copy the php4apache2.dll file from the sapi directory!
AddType application/x-httpd-php .php

# For PHP 5 do something like this:
LoadModule php5_module "c:/php/php5apache2.dll"
AddType application/x-httpd-php .php

# configure the path to php.ini
PHPIniDir "C:/php"

Note: 위 예제에서 c:/php/을 실제 PHP 경로로 변경하십시오. LoadModule 지시어에 php4apache2.dll이나 php5apache2.dll을 사용하는 점에 주의하십시오. php4apache.dll이나 php5apache.dll아닙니다. 이들은 아파치 1.3.x에 사용하도록 설계되었습니다.

Note: 내용 협상을 사용하려면, 관련 FAQ를 읽어보십시오.

Warning

DLL 파일을 다른 PHP 버전과 섞지 마십시오. DLL 사용과 확장을 모두 내려받은 PHP 버전에서 사용해야 합니다.



add a note add a note User Contributed Notes
마이크로소프트 윈도우에서 Apache 2.0.x
nicolas dot grasset at gmail dot com
07-Jul-2009 05:08
Here is how I created a silent install for Apache2.2 and PHP5.2.10 on Windows XP (running on a MacBook Pro):

Download Apache2 and PHP5 installer files in a directory and update the msi file names in the following commands.

To have PHP installer find Apache2, do not forget APACHEDIR!

msiexec /i apache_2.2.11-win32-x86-no_ssl.msi /passive ALLUSERS=1 SERVERADMIN=admin@localhost SERVERNAME=localhost SERVERDOMAIN=localhost SERVERPORT=80 INSTALLDIR=c:\apache
msiexec /i php-5.2.10-win32-installer.msi /qn APACHEDIR=c:\apache INSTALLDIR=c:\php ADDLOCAL=ext_php_mssql,apache22
net stop "Apache2.2"
net start "Apache2.2"
m008 at springtimesoftware dot com
12-Jun-2009 10:14
Since Apache and PHP are often used together, and since it is difficult to configure the various versions, and since neither the official Apache or PHP websites or manuals contain clear, complete, and correct configuration instructions, and since hundreds of hours of wasted time has been spent, and since several of the user notes here contain conflicting advice, I hereby respectfully ask both the Apache and PHP development groups to study this issue and develop and release a simple automated tool (either to do the configuring OR to display instructions) that works for all valid version combinations.

David Spector
Springtime Software
CP
16-Apr-2009 06:27
This is old news to some. But people with Apache 2.0.55 / PHP 5.1.2 might like a reminder before they pull their hair out! (Some of us have ISPs using older version and need to test on a like version before we upload.)

If using PHP 5.1.2, to run Apache as a module, do *not* use Stephan's "php5apache2.dll" from http://www.ApacheLounge.com. That is for pre-5.1.2!

**There is a "php5apache2.dll" included with Windows PHP 5.1.2 zip file by default.**

If you forget this and overwrite the included DLL with Stephan's (as I did) you'll spend hours attempting to escape "DLL hell", with no success.
Anonymous
26-Feb-2009 02:32
i followed henke37's way to for the httpd.conf

I added all this at the very end of httpd.conf

# For PHP 5
#load the php main library to avoid dll hell
Loadfile "C:\php-5.2.8-Win32\php5ts.dll"

#load the sapi so that apache can use php
LoadModule php5_module "C:\php-5.2.8-Win32\php5apache2_2.dll"

#set the php.ini location so that you don't have to waste time guessing where it is
PHPIniDir "C:\php-5.2.8-Win32"

#Hook the php file extensions
AddHandler application/x-httpd-php .php
AddHandler application/x-httpd-php-source .phps

Also i didn't use short open tags as they are disabled in
"php.ini-recommended" if you don't change anything
So use this to test
<?php
 phpinfo
();
?>
NOT
<? phpinfo(); ?> short open tags

added my php directory to the PATH system variable and i start apache manually not as a service

It works for me hope it helps you!
cormac at kernan dot eu
21-Apr-2008 01:08
All good advice from henke, except where it says "Do not edit the system path".  You will NOT be able to load extensions that have dependencies e.g. MySQL, without adding PHP to your system path.  This threw me for some time as other extensions without dependencies will work without this requirement.
cfoesterle at yahoo dot com
10-Feb-2008 04:41
I do not have IIS installed on my server, only Apache. So I had to edit the PHP.ini file and comment out (add leading ";") to the following line "extension=php_iisfunc.dll" as I was getting "Faulting application httpd.exe, faulting module php_iisfunc.dll" errors when this line was active. I also added an additional  "AddType application/x-httpd-php .html" to my httpd.conf file so that inline php would work with files ending with an extension of ".html" on my server.
mjm at alum dot mit dot edu
27-Jan-2008 04:33
If you use the PHP 5 installer, you'll notice that it uses the wrong type of slash on Windows!

Change C:/Program Files/PHP/" to C:\Program Files\PHP\" and everything works great!
packard_bell_nec at hotmail dot com
03-Oct-2007 03:24
If you install PHP as an Apache CGI binary, you can add:
AddHandler cgi-script .php
into Apache httpd.conf, and add shebang line to every PHP scripts like:
#!php
<?php
phpinfo
();
?>
. But adding shebang line has a disadvantage that if you decided to install PHP as an Apache module afterwards, then the shebang line WILL appear in the web page.
In fact, you do NOT need to add shebang line to every PHP script even if you install PHP as an Apache CGI binary, because you can add:
ScriptInterpreterSource Registry-Strict
into Apache httpd.conf, and make the registry file and merge it like:
Windows Registry Editor Version 5.00
[HKEY_CLASSES_ROOT\.php\Shell\ExecCGI\Command]
@="\"C:\\Program Files\\PHP\\php-cgi.exe\""
. Then you will NOT need to change the PHP scripts which do not contain shebang line.
philippeboucher at newlogiccanada dot com dot com
31-Jul-2007 09:05
To do a silent install of PHP wich correctly modify the httpd.conf file, you HAVE (I find no other way) to put the directory of the Apache inside the INSTALLDIR's MSI option.  the APACHEDIR doesn't seem to work.  That's the only way I've make it work.  Maybe it's because my Apache is not in the default directory, I don't know, but there is a solution for people who cannot make work the silent install (for those who are told by the php setup that it cannot find the httpd.conf file).

Hope it helps someone.
anonymousness
15-Jun-2007 02:30
Verrrrrrrry important note:

If you enable multi-byte strings for your installation of PHP, the extension loaded MUST be the first extension in the list.

Apache, NOR PHP will generate any error messages or warning information in the error log or in system logs about this.

This information needs to be included in the Readme or in the distributed INI files.

The recommended PHP ini's should place extension=php_mbstring.dll  at the top of the list of extensions.

I had completely forgotten about this when recently upgrading php on a test server; and almost set out to re-install apache.
charlie at oblivion dot cz
15-Feb-2007 12:19
..try to set the extension_dir in php.ini to the absolute path.. (when you are pretty sure that you have set the PHPIniDir the right way)
Jim Keller
11-Jan-2007 01:35
it's important to note that on Apache 2.2.3 (probably other 2.x versions as well) on Windows, the PHPIniDir directive must use forward slashes to delimit directories, not the backslashes commonly used for Windows path strings. If PHP seems to be ignoring the directive, this may be why.
pcdinh at phpvietnam dot net
07-Oct-2006 10:50
PHP 6 is under active development but for those whose want to try out the new features or just want to keep updated with the development progress of PHP 6.0, you can follow my instructions below to install it on Windows XP and Apache 2.2.3

# For PHP 6 do something like this:
LoadModule php5_module "c:/server/php6/php6apache2_2.dll"
AddType application/x-httpd-php .php
PHPIniDir "c:/server/php6"

You should change the path as in your system. The directive LoadModule php5_module seems a bit strange to you. It should be LoadModule php6_module instead. However, I have just taken a look at php.internals and came across a message that said it should be changed in the near future after the PHP 5.2 is official released. At the time I write this, PHP 5.2 RC6 is planned to be released in the next few days.
subajawa at yahoo dot com
04-Aug-2006 08:56
To install PHP as Apache 2 CGI script, add these lines in addition to the 3 lines mentioned in the document.

<Directory "C:/php">
    AllowOverride None
    Options None
    Order allow,deny
    Allow from all
</Directory>
Isaac dot Brown at ArvinMeritor dot com
17-May-2005 12:59
Some XP machines are having troubles with the PHPIniDir derective not finding the php.ini (or so they think). Directories that do contain a php.ini file are returned as empty and it defaults to the next method of finding php.ini (often C:/windows or C:/winnt).

This is likely caused by read permissions not being set correctly on NTFS file systems, however, it has occurred when no cause could be identified. If setting correct file permissions doesn't work, the easiest way around this problem is moving php.ini to the Apache directory or adding the HKEY_LOCAL_MACHINE\SOFTWARE\PHP\IniFilePath string to your registry and setting it to the correct directory.

 
show source | credits | stats | sitemap | contact | advertising | mirror sites