설치

이 섹션은 PHP 설치에 관한 일반적인 질문을 다루고 있습니다. PHP는 대부분의 OS(OSX 이전의 MacOS는 예외)와 대부분의 웹 서버에서 사용할 수 있습니다.

PHP를 설치하려면, 설치와 설정에 있는 지시를 따르십시오.

  1. 왜 제품 환경에서 아파치2 쓰레드 MPM을 사용할 수 없습니까?
  2. 유닉스/윈도우: php.ini 파일을 어디에 놓아야 합니까?
  3. 유닉스: PHP를 설치하였지만, 문서를 읽을 때 마다 'Document Contains No Data'를 얻습니다! 대체 뭡니까?
  4. 유닉스: RPMS를 사용해서 PHP를 설치했지만, 아파치가 PHP 페이지를 처리하지 않습니다! 대체 뭡니까?
  5. 유닉스: 아파치에 FrontPage 확장 패치를 적용하였더니, 갑자기 PHP가 작동하지 않습니다. PHP가 아파치 FrontPage 확장과 호환되지 않습니까?
  6. 유닉스/윈도우: PHP를 설치하였지만, 브라우저에서 PHP 스크립트 파일에 접근하면 빈 화면이 나옵니다.
  7. 유닉스/윈도우: PHP를 설치하였지만, 브라우저에서 PHP 스크립트 파일에 접근하면 서버 500 오류가 나옵니다.
  8. 몇몇 OS: 오류 없이 PHP를 설치했지만, 아파치를 시작하려 할 때 정의되지 않은 심볼 오류가 나옵니다: [mybox:user /src/php4] root# apachectl configtest apachectl: /usr/local/apache/bin/httpd Undefined symbols: _compress _uncompress
  9. 윈도우: PHP를 설치하였지만, 브라우저에서 PHP 스크립트 파일에 접근할 때, 오류가 발생합니다: cgi error: The specified CGI application misbehaved by not returning a complete set of HTTP headers. The headers it did return are:
  10. 윈도우: 모든 지시를 따랐는데, PHP와 IIS가 여전히 작동하지 않아요!
  11. IIS, PWS, OmniHTTPD, Xitami에서 PHP를 CGI로 실행할 때, 다음 오류가 나옵니다: Security Alert! PHP CGI cannot be accessed directly..
  12. 내 php.ini가 발견되고 읽어지는지 어떻게 압니까? 내 변경점이 적용되지 않는 것 같습니다.
  13. 윈도우에서 어떻게 PHP 디렉토리를 PATH에 추가합니까?
  14. 윈도우에서 어떻게 php.ini 파일을 사용하게 합니까?
  15. PHP와 아파치 내용 협상(MultiViews 옵션)을 사용할 수 있습니까?
  16. PHP는 GET과 POST 요청 메쏘드만 처리하도록 제한됩니까?
왜 제품 환경에서 아파치2 쓰레드 MPM을 사용할 수 없습니까?

PHP는 접착제입니다. 수많은 써드파티 라이브러리를 합쳐서 직관적으로 일관성 있게 하고, 배우기 쉬운 언어 인터페이스로 붙여서 좋은 웹 어플리케이션을 만드는 접착제입니다. PHP의 유연성과 힘은 놓여지는 플랫폼의 안정성과 강력함에 의존합니다. 작동하는 OS, 작동하는 웹 서버, 붙일 수 있는 작동하는 써드파티 라이브러리가 필요합니다. 이들 중 하나라도 작동을 멈췄을 때, PHP는 문제를 발견하고 빠르게 고칠 수 있는 방법이 필요합니다. 놓여지는 프레임워크에 완전히 분리된 실행 쓰레드, 완전히 분리된 메모리 세그먼트, 각 요청이 실행되는 강한 그릇을 갖추지 못한다면, PHP 시스템에 예상할 수 없는 약점을 가져옵니다.

쓰레드 MPM을 사용해야 한다면, PHP가 자신의 메모리 공간을 가지고 실행되는 FastCGI 설정을 살펴보십시오.

마지막으로, 쓰레드 MPM을 사용하는 것에 대한 이 경고는 윈도우 시스템에는 강요되지 않습니다. 플랫폼에 쓰이는 대부분의 라이브러리가 쓰레드 안전하게 짜여져 있기 때문입니다.

유닉스/윈도우: php.ini 파일을 어디에 놓아야 합니까?

기본값으로, 유닉스에서는 <install-path>/lib/usr/local/lib에 위치해야 합니다. 많은 사람들이 컴파일 시에 --with-config-file-path 플래그로 이를 변경합니다. 예를 들면, 다음과 같이 설정할 수 있습니다:

--with-config-file-path=/etc
이렇게 하면, 배포판의 php.ini-dist/etc/php.ini에 복사하여 수정함으로써 원하는 변경을 적용할 수 있습니다.

--with-config-file-scan-dir=PATH

윈도우에서 php.ini 파일의 기본 경로는 윈도우 디렉토리입니다. 아파치 웹서버를 사용한다면, 우선 아파치 설치 디렉토리에서 php.ini를 검색합니다. 즉, c:\program files\apache group\apache 입니다. 이 방법으로 같은 머신에서 작동하는 다른 버전의 아파치에서 각각의 php.ini 파일을 사용할 수 있습니다.

설정 파일 챕터를 참고하십시오.

유닉스: PHP를 설치하였지만, 문서를 읽을 때 마다 'Document Contains No Data'를 얻습니다! 대체 뭡니까?

아마도 PHP에 문제가 있어서 코어 덤프가 일어남을 의미합니다. 이런 경우엔 서버 오류 기록을 살펴보고, 작은 테스트 방식을 사용해서 문제가 재발하는지 확인해보십시오. 'gdb'를 사용할 줄 안다면, 오류 보고에 역추적을 제공해주십시오. 개발자가 문제를 파악하기 쉽습니다. PHP를 아파치 모듈로 사용한다면 다음과 같이 해보십시오:

  • httpd 프로세스 중지

  • gdb httpd

  • httpd 프로세스 중지

  • > run -X -f /path/to/httpd.conf

  • 브라우저에서 문제가 발생하는 URL을 시도합니다

  • > run -X -f /path/to/httpd.conf

  • 코어 덤프를 얻는다면, 여기에서 gdb가 이를 알려줍니다

  • type: bt

  • 오류 보고에 역추적을 포함시킵니다. » http://bugs.php.net/에서 제출할 수 있습니다.

스크립트가 정규 표현식 함수(preg_match() 계열)를 사용한다면, PHP와 아파치를 동일한 정규 표현식 패키지로 컴파일해야 합니다. PHP와 아파치 1.3.x에서는 자동으로 됩니다.

유닉스: RPMS를 사용해서 PHP를 설치했지만, 아파치가 PHP 페이지를 처리하지 않습니다! 대체 뭡니까?

아파치와 PHP를 모두 RPM 패키지로 설치했다고 가정하면, httpd.conf 파일에서 다음 줄 중 일부나 전체를 추가하거나 주석을 해제해야 합니다:

# Extra Modules
AddModule mod_php.c
AddModule mod_php.c
AddModule mod_perl.c

# Extra Modules
LoadModule php_module         modules/mod_php.so
LoadModule php5_module        modules/libphp5.so     # for PHP 5
LoadModule perl_module        modules/libperl.so
그리고 추가로:
AddType application/x-httpd-php .php
...를 전역 프로퍼티에 넣거나, PHP 지원을 추가할 VirtualDomain의 프로퍼티에 넣어야 합니다.

유닉스: 아파치에 FrontPage 확장 패치를 적용하였더니, 갑자기 PHP가 작동하지 않습니다. PHP가 아파치 FrontPage 확장과 호환되지 않습니까?

아니오, PHP는 FrontPage 확장과 함께 작동합니다. 문제는 FrontPage 패치가 PHP가 의존하는 아파치 구조를 변경했기 때문입니다. FP 패치를 한 후에 PHP를 재컴파일('make clean ; make'를 사용)하면 문제가 해결될 것입니다.

유닉스/윈도우: PHP를 설치하였지만, 브라우저에서 PHP 스크립트 파일에 접근하면 빈 화면이 나옵니다.

웹 브라우저에서 '소스 보기'를 하면 PHP 스크립트의 소스 코드가 나올겁니다. 이는 웹 서버가 스크립트를 PHP에 해석하도록 보내지 않았음을 의미합니다. 서버 설정이 무언가 잘못되었습니다 - PHP 설치 지시에 따라서 서버 설정을 다시 확인해보십시오.

유닉스/윈도우: PHP를 설치하였지만, 브라우저에서 PHP 스크립트 파일에 접근하면 서버 500 오류가 나옵니다.

서버가 PHP를 실행하려 할 때 무언가 잘못되었습니다. 확인할 수 있는 오류 메세지를 얻으려면, 명령줄에서 PHP 실행(윈도우에서는 php.exe이 있는 디렉토리로 변경하고 php -i를 실행하십시오. PHP 실행에 문제가 있으면, 적절한 오류 메세지가 나올 것이고, 이로써 해결을 위한 실마리를 얻을 수 있습니다. HTML 코드로 스크린이 채워진다면(phpinfo()의 출력) PHP는 작동하고, 문제는 서버 설정일 것입니다. 다시 확인해보십시오.

몇몇 OS: 오류 없이 PHP를 설치했지만, 아파치를 시작하려 할 때 정의되지 않은 심볼 오류가 나옵니다:
[mybox:user /src/php4] root# apachectl configtest
 apachectl: /usr/local/apache/bin/httpd Undefined symbols:
  _compress
  _uncompress

정확히 말하면, PHP는 아무 문제가 없지만 MySQL 클라이언트 라이브러리에 문제가 있습니다. 몇몇 경우 --with-zlib 이 필요합니다. MySQL FAQ에서도 다루고 있습니다.

윈도우: PHP를 설치하였지만, 브라우저에서 PHP 스크립트 파일에 접근할 때, 오류가 발생합니다:

cgi error:
The specified CGI application misbehaved by not
returning a complete set of HTTP headers.
The headers it did return are:

이 오류 메세지는 PHP가 무언가를 출력하는데 실패했음을 의미합니다. 확인할 수 있는 오류 메세지를 얻으려면, 명령줄에서 PHP 실행(윈도우에서는 php.exe)이 있는 디렉토리로 변경하여 php -i를 실행하십시오. PHP 실행에 문제가 있으면, 적합한 오류 메세지가 나오므로, 이를 해결의 실마리가 됩니다. HTML 코드로 화면이 가득 찬다면(phpinfo() 함수의 출력) PHP는 작동합니다.

PHP가 명령줄에서 작동한다면, 다시 브라우저에서 스크립트에 접근해보십시오. 여전히 실패한다면 다음 중 하나입니다:

  • PHP 스크립트, php.exe, php4ts.dll, php.ini, 적재하려는 PHP 확장의 파일 접근 권한 문제입니다. 익명 인터넷 사용자 ISUR_<machinename>이 이들에 접근할 수 없습니다.
  • 스크립트 파일이 존재하지 않습니다. (혹은, 웹 루트 디렉토리에서 상대 경로가 생각한 것과 다릅니다) IIS에서는 Internet Services Manager에서 'check file exists' 박스를 켬으로써 이 오류를 추적할 수 있습니다. 스크립트 파일이 존재하지 않는다면 서버가 404 오류를 내보냅니다. 이는 IIS가 스크립트 파일의 NTLanMan 권한에 기반한 인증을 수행하는 추가적인 장점이 있습니다.
윈도우: 모든 지시를 따랐는데, PHP와 IIS가 여전히 작동하지 않아요!

PHP 스크립트를 실행해야 하는 사람이 php.exe를 실행할 권한이 있는지 확인하십시오! IIS는 IIS가 설치되었을 때 추가된 익명 사용자를 사용합니다. 이 사용자가 php.exe에 권한이 있어야 합니다. 또한, 모든 인증된 사용자도 php.exe를 실행할 권한이 있어야 합니다. 그리고 IIS4에서는 PHP가 스크립트 엔진임을 알려야 합니다. 이 faq도 읽어보십시오.

IIS, PWS, OmniHTTPD, Xitami에서 PHP를 CGI로 실행할 때, 다음 오류가 나옵니다: Security Alert! PHP CGI cannot be accessed directly..

cgi.force_redirect 지시어를 0으로 설정해야 합니다. 기본값이 1이므로 지시어를 (;으로) 주석처리하면 안됩니다. 다른 지시어와 마찬가지로, php.ini에서 설정합니다.

기본값이 1이기 떄문에, 정확한 php.ini를 읽고 있는지 100% 확인하는게 중요합니다. 자세한 내용은 이 faq를 읽어보십시오.

php.ini가 발견되고 읽어지는지 어떻게 압니까? 내 변경점이 적용되지 않는 것 같습니다.

어떤 php.ini를 PHP에서 읽는지 확인하려면, phpinfo()를 호출하십시오. 윗 부분에, Configuration File (php.ini) 목록이 존재합니다. 이는 PHP가 어디에서 php.ini를 찾고 읽었는지 여부를 알려줍니다. 디렉토리 PATH만 존재한다면, 읽어지지 않은 것이므로, php.ini를 그 디렉토리에 넣으십시오. php.ini가 PATH에 포함되어 있다면, 읽혀지는 것입니다.

php.ini가 읽혀지고 PHP를 모듈로 사용한다면, php.ini를 변경한 후에 웹 서버를 재시작하십시오.

php_ini_loaded_file() 참고.

윈도우에서 어떻게 PHP 디렉토리를 PATH에 추가합니까?

윈도우 NT, 2000, XP, 2003에서:

  • 제어판에 가서 시스템 아이콘을 엽니다. (시작 -> 설정 -> 제어판 -> 시스템, 윈도우 XP/2003에서는 시작 -> 제어판 -> 시스템)

  • 고급 탭으로 갑니다

  • '환경 변수' 버튼을 클릭

  • '시스템 변수' 부분을 봅니다

  • Path 엔트리를 찾습니다 (스크롤해야 할 수 있습니다)

  • Path 엔트리를 더블 클릭

  • 끝 부분에 ';'를 앞에 덧붙여서 PHP 디렉토리를 넣습니다 (즉, ;C:\php)

  • 확인을 누르고 컴퓨터를 재시작합니다

윈도우 98/Me에서는 autoexec.bat 파일을 수정해야 합니다:

  • 메모장을 엽니다 (시작 -> 실행, notepad를 칩니다)

  • C:\autoexec.bat 파일을 엽니다.

  • PATH=C:\WINDOWS;C:\WINDOWS\COMMAND;..... 줄에 위치하여 추가: 줄 마지막에 ;C:\php

  • 파일을 저장하고 컴퓨터를 재시작합니다

Note: 위 단계가 완료된 후에 PATH 변경이 적용되도록 재부팅하십시오.

PHP 매뉴얼이 파일을 윈도우 시스템 디렉토리에 넣도록 하는 경우가 있는데, 이 디렉토리(C:\Windows, C:\WINNT 등)가 기본적으로 시스템 PATH에 있기 때문입니다. 윈도우 시스템 디렉토리로 파일을 복사하는건 배제된지 오래되었고, 문제가 발생할 수 있습니다.

윈도우에서 어떻게 php.ini 파일을 사용하게 합니까?

여러 방법이 있습니다. 아파치를 사용한다면, 적합한 설치 지시를 읽어보십시오. (아파치 1, 아파치 2) 그 외의 경우에는 PHPRC 환경 변수를 설정해야 합니다:

윈도우 NT, 2000, XP, 2003에서:

  • 제어판에 가서 시스템 아이콘을 엽니다. (시작 -> 설정 -> 제어판 -> 시스템, 윈도우 XP/2003에서는 시작 -> 제어판 -> 시스템)

  • 고급 탭으로 갑니다

  • '환경 변수' 버튼을 클릭

  • '시스템 변수' 부분을 봅니다

  • '새로 만들기'를 클릭하고 변수 이름에 'PHPRC', 변수 값에 php.ini가 위치한 디렉토리를 넣습니다. (예. C:\php)

  • 확인을 누르고 컴퓨터를 재시작합니다

윈도우 98/Me에서는 autoexec.bat 파일을 수정해야 합니다:

  • 메모장을 엽니다 (시작 -> 실행, notepad를 칩니다)

  • C:\autoexec.bat 파일을 엽니다.

  • 파일 마지막에 새 줄을 추가합니다: set PHPRC=C:\php (C:\phpphp.ini가 위치한 디렉토리로 치환합니다) 경로에 공백을 포함할 수 없는 점에 주의하십시오. 예를 들어, PHP를 C:\Program Files\PHP에 설치하였다면, C:\PROGRA~1\PHP를 넣어야 합니다.

  • 파일을 저장하고 컴퓨터를 재시작합니다.

PHP와 아파치 내용 협상(MultiViews 옵션)을 사용할 수 있습니까?

PHP 파일로 연결이 확장자를 포함하면, 완벽하게 작동합니다. 이 FAQ는 PHP 파일이 확장자를 포함하지 않는 경우와, 확장자 없는 URL에서 내용 협상으로 PHP 파일을 고르는 방법만 다룹니다. 이 경우, AddType application/x-httpd-php .php 줄을 교체합니다:

# PHP 4
AddHandler php-script php
AddType text/html php

# PHP 5
AddHandler php5-script php
AddType text/html php
이 해결법은 아파치 1에서는 작동하지 않습니다. PHP 모듈이 php-script을 잡아내지 못하기 때문입니다.

PHP는 GET과 POST 요청 메쏘드만 처리하도록 제한됩니까?

아니오, CONNET 등, 어떠한 요청 메쏘드도 다룰 수 있습니다, 적합한 응답 상태는 header()로 보낼 수 있습니다. GET과 POST 메쏘드만 다뤄야 할 경우에는, 아파치 설정으로 가능합니다:

<LimitExcept GET POST>
Deny from all
</LimitExcept>

add a note add a note

User Contributed Notes 19 notes

up
9
per dot fikse at ipj dot no
18 years ago
Installing PHP 4 or 5 on Windows Server 2003 x64 results in http error 505. This is not a PHP bug. It is due to running a 32-bit ISAPI DLL under the 64-bit version of IIS 6, as documented here: http://support.microsoft.com/?id=895976

Solution: Flip the Metabase flag for Enable32bitAppOnWin64 as described in http://support.microsoft.com/?id=894435 ,
like this: CSCRIPT ADSUTIL.VBS SET W3SVC/AppPools/Enable32bitAppOnWin64 1

(Alternatively with full path: cscript %SYSTEMDRIVE%\inetpub\adminscripts\adsutil.vbs SET W3SVC/AppPools/Enable32bitAppOnWin64 1)
up
2
emzeperx at emzeper dot hu
18 years ago
You do not have to restart the whole system make effect of changing the PATH env var. For me (sbs2003) worked automatically.
on older systems you can use

set $Path=%path%;c:\php

command to extend immediately the path var.
up
2
ssaxena at nriol dot com
14 years ago
Here are my struggle to get PHP 5.2.12 working on Windows XP SP3, IIS 5.1 (Please note Win XP SP3 has issue of FastCGI)

1. Dowloaded installer and installed in C:\Program Files\PHP as ISAPI module

---->Did not work

Added php5isapi.dll in ISAPI Filter and added the extension .php in Home Dir->Configuration
(For every setting change restarted IIS on cmd->iisreset)

---->Did not work

(And the Google was pointing to the Fast CGI issue; Don't know why microsoft has MS-FAST ! )
Uninstalled the PHP and cleaned up the folders, PATH environment variable & PHPRC, the IIS settings and registry entries and shut down(restart is different from shut down) the system to make it very clean

2. Reinstalled the PHP in C:\PHP as ISAPI and did the same as above in IIS
(For every setting change restarted IIS on cmd->iisreset)

---->Did not work

Uninstalled and cleaned up same as above and took a breath to make sure what I am doing wrong.
Shutdown the system.

3. Unzipped the php-5.2.12-Win32.zip and did the same as above (this time manually PATH variable and security permission for the PHP folder and following settings)

short_open_tag = On
error_reporting = E_ALL & ~E_NOTICE
display_errors = On
doc_root = "C:\Inetpub\wwwroot"
extension_dir = "C:\PHP\ext"
cgi.force_redirect = 0

---->Did not work

Uninstalled and cleaned up same as above
Shutdown the system.

4. Downloaded Microsoft Web Platform Installer 2.0 and select the PHP+Fast CGI+Windows Cache for PHP extension and Web Deployment Tools
restarted the system to take effect the settings

---->Did not work

Uninstalled and cleaned up same as above
Shutdown the system

5. Took the prev version of PHP php-5.2.4-Win32.zip unzip the folder and did the following changes:

short_open_tag = On
error_reporting = E_ALL & ~E_NOTICE
display_errors = On
doc_root = "C:\Inetpub\wwwroot"
extension_dir = "C:\PHP\ext"
cgi.force_redirect = 0

set the security permission as IIS_machinename with full access to the C:\PHP folder

------->IT GOT WOKRING

Hope people would be aware of php-5.2.12 and would love the php-5.2.4
up
2
knutw at sparhell dot no
17 years ago
I recntly upgraded from PHP 5.1 to 5.2 on my Windows Server 2003 using IIS6. I selected CGI as before. My PHP folder is as always C:\Program Files\PHP. I also edited my brand new php.ini, enabling all my old extensions and recommended settings for IIS. I like not to keep my old config into a new version.

After upgrade, I just got blank pages in my browser, and the response status was 404 Not found.

I checked my installation twice, using this FAQ, but got no way.

Then I went to IIS Manager, Web Service Extensions. The php Service Extension was Allowed as it should. I deleted the Service Extension and added it. The old extension used short file names containing tilde (PROGRA~) character, but I don'æt know if that gas anything to do with the problem. Anyway, after allowing my" new" Service Extension, pointing to php-cgi.exe as before, mye web sites suddenly worked. So will revommend anyone with thos problem to delete and add the Servcie Extension. It didn't help re-allowing it, restarting IIS or the complete server.
up
1
nigel dot salt at hotmail dot com
20 years ago
Finally got IIS 5 and PHP 5 to talk. 

What worked for me was:

1) Set
[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\
W3SVC\Parameters\Script Map]
".php"="your path to php\\php.exe"

2) ensure there is not a php.ini in the windows system folder and that there is one wherever you've put PHP

3) edit php.ini and set cgi force redirect to 0 and cgi.rfc2616_headers = 1

4) Put the PHP scripts in their own folder underneath the inetpub root

5) Open the IIS console, right click your new php folder
In the Directory tab
set application name to the name of the folder
set executable and script as permission
set application protection to low
Click configuration and check that .php is mapped to wherever you put
PHP

Restart IIS

Try a very simple PHP page and it should work

Nigel
up
1
john dot calder at manukau dot ac dot nz
15 years ago
WINDOWS 2003 and IIS.  BIG LESSON FOR ME was "don't mess with the optional components".
I had lots of trouble until I tried installing without asking for extras and then it was very smooth.
I have found no need to set up paths. 
I have found no need to configure IIS. 
I have found no need to change security on the PHP folder.

What works for me with Windows/IIS:

1.  You need to be logged-on as "administrator"

2.  Run  "php-5.2.6-win32-installer.msi"
Your ONLY action during this wizard is to select "IIS ISAPI" as the webserver.  Do NOT CHANGE anything else!  I am guessing that the optional extras apply only to Apache because after enabling them I see Apache-related error messages.

3.  Setup a test virtual directory as you would for an ASP or ASP.NET web app.  eg "phptest"
Then use notepad to create a test page eg "test.php"
<?php
phpinfo
();
?>

4.  In Internet Explorer, test with eg this address
http://localhost/phptest/test.php

IF this does not give you a beautiful page of details THEN start reading other advice on this page - especially helpful for me was the faq advice to test run "php.exe -i" from the command prompt.
up
1
charleslynch at xybersoftware dot com
15 years ago
One final note to the message below if you are getting the message about not having rights to execute...You need to use IIS right click on the website and choose 'Properties/Home Directory' then on the 'Execute Permissions' combo box you need to choose 'Scripts only'...Click ok...another dialog may appear asking which directories to apply the action too...choose any directories that you intend on using php in and click ok...It should work now...
up
1
JUSTANOTHERUSER
18 years ago
<LimitExcept GET POST>
Deny from all
</LimitExcept>

Does not work with Apache2+ & PHP5 . Apache Refuses to start
up
1
scott at chaisson dot net
16 years ago
Windows 2000 Server and IIS (SP4 and all patches):

After many frustrating hours of trying to figure out the install (again), It took a while, but here are a couple tips:

PHP working with IIS uses c:\winnt\php.ini

It doesn't matter what you set the path to, nor what you set the PHPRC environment variable to. After you get PHP running correctly in the installation folder (using php -i) copy the php.ini file into the c:\winnt folder.

Here's what worked for me:

- Add PHP path to System environment variable

- Add php5activescript.dll from http://snaps.php.net/ to the PHP folder, then Register it: "regsvr32 php5activescript.dll"

Set extension_dir and doc_root directives in PHP.INI:
  extension_dir = C:\WWW\PHP\ext
  doc_root = C:\WWW\Site
  cgi.force_redirect = 0

(the last cgi.force_redirect isn't required, but I like to set it anyway)

Copy the .INI file into WINNT folder

In IIS Manager, right-click "Default Web Site", Click "Home Directory",
  Click "Configuration", "Add" the ISAPI application:
    Executable: <your php install>\php5isapi.dll
    Extension: .php
    Limit to: GET,HEAD,POST
    Check: "Script Engine"
    Uncheck: "Check that file exists"

Finally: Set up an ISAPI filter:
  Click the "ISAPI Filters" tab,
  Filter Name: PHP
  Executable: <your php install>\php5isapi.dll

Notes: You don't have to set any of your folders as "Script source" folders. .PHP files aren't scripts, merely text files that require processing before being shipped off to the browser, which is what the ISAPI filter does.

Finally, working again.

Chase
up
1
Meiki67 skipthis at geemail
16 years ago
Had a hard day to MSI install 5.2.3 on WinXP with MySQL. I use a drive substitution (subst drive: path - in my case subst d: c:\drive_d) and installed PHP in D:\PHP - which in reality is C:\DRIVE_D\PHP.  To make a long story short - only after (1) changing all substituted D:\ back to C:\DRIVE_D and (2) resolving all DOS short names to Win long names PHP started to work. The first one is clear - the substitution works only for the active console user - not for services or IUSR. For the second one I have no explanation, since DOS short names should work systemwide - maybe Win handles them correctly but PHP not ?

BTW <?php phpinfo(); ?> was of tremendeous help

Meiki
up
1
Curtis
16 years ago
I have some additional troubleshooting tips for 53.7, which deals with getting a blank screen on your browser when running a PHP script.

In addition to server misconfiguration, it may also be that PHP isn't configured to output errors to the browser, which is the case if you or your host uses a more secure php.ini. If this is the case, you need to find out where errors are being logged to find out if any errors are preventing normal output from being delivered to the client.

If you have access to php.ini, check the 'display_errors' directive, which is, by default, located under the 'error_reporting' directive. It's helpful to have 'display_errors' on during debugging phases, but best to have it off in production environments.

Related functions: http://php.net/ini_set | http://php.net/error_reporting | http://php.net/error_log
up
1
jeff_graham at datacenterservices dot net
20 years ago
As stated within the note "jimo at mail dot azhsv dot com
29-Nov-2003 04:33
PHP 4 and IIS 6.0 (Windows Server 2003)," I found the same steps were requiered for installation of PhP 5 beta 3 on my Windows 2003 server (Standard Edition)
up
1
jimo at mail dot azhsv dot com
20 years ago
PHP 4 and IIS 6.0 (Windows Server 2003)

Had difficulty getting PHP 4.3.3 to work with Win2003 Ent Server for use with SquirrelMail.  Problem found and believed solved.  Appears to be something New with IIS 6.0 (More security by Micro$oft)  Was getting 404 error and php was not being run as a cgi even though it was in extensions and IIS user had rights to execute it. (php from command line operated correctly)

If you are installing on Windows Server 2003 (only have Enterprise Edition Not sure if this applies to standard edition), and you have done the normal procedures for inclusion of PHP scripts (either ISAPI or CGI) in IIS, you will still get a 404 error when attempting to execute those scripts even though IIS has rights and the extension points to the correct file.  To alleviate this problem, perform the following:

1.    Open a command prompt window
2.    Change to C:\windows\system32
3.    Execute the command:  cscript  iisext.vbs /AddFile c:\php\php.exe 1 php 0 php
4.    Execute the command:  cscript iisext.vbs /EnFile c:\php\php.exe
5.    To check for correct execution of the above,
6.    Execute the command:  cscript IisExt.vbs /ListFile the php extension should be listed

If you try just step 4 without step 3 you get an error that the file is not in the list (and wont be there till you do step 3 above)

After this, IIS seems to like the php extension and work normally.

For additional reference, see the below 3 Micro$oft KB Articles:
HOWTO: Enable and Disable ISAPI Extensions and CGI Applications in IIS 6.0 (MS KB Article 328360)

HOWTO List Web Server Extensions and Extension Files in IIS 6.0 (MS KB Article 328505)

HOWTO Add and Remove Web Service Extension Files in IIS 6.0 (MS KB Article 328419)
up
0
christianfelix at laszlo dot com
16 years ago
For Windows XP users

Just add php.ini to windows/system 32 and also save a copy in the setup folder e.g. c:/php/php.ini, c:/php5/php.ini,

You have to follow the suggestions, add to path, uncomment extensions and voila!!
up
0
Anonymous
17 years ago
After setting the PHPRC environment variable, none of my PHP files would hit the preprocessor. The browser was just serving out PHP source code right there in the "view source."

The manual was telling me to set this var to "c:\php," but nothing was working. It's almost as if IIS/Win2000 wasn't reading my php.ini at all.

After I set that variable to "c:\php\php.ini," all of a sudden I was getting honest to goodness PHP pages working.
up
0
peter dot mosinskisNOSPAM at csuci dot edu
21 years ago
Running Win2K AS + IIS5.0 + PHP 4.3.1, I ran into a nasty problem that I mistakenly thought had to do with something in the php.ini configuration. When I would try to submit a form using the HTTP method GET it would work, but I would get a "404 Page Not Found" error using the POST method.

All my permissions were set correctly, the php.ini was configured correctly. It had to do with URLScan being installed on IIS (see below)

Page 404 File Not Found Error When Using POST method in PHP (and Perl, and otherwise)
-------------------------------------------

This is related to the Microsoft URLScan utility. If you have this problem, the IIS administrator has probably run the IIS Lockdown tool as well as configured URLScan to reject this type of HTTP method when sent in a URL. These tools are meant to enhance web server security.

URLScan configuration files can be found in the \WINNT\system32\inetsrv\urlscan folder on the web server. Specifically, the file to modify is urlscan.ini.

The changes to make are as follows:
1. Make sure UseAllowVerbs=1 under [options]
2. Under the [AllowVerbs] section, list your allowed HTTP methods to include:
    GET
    POST

For more information on the IIS Lockdown tool and URLScan, visit http://technet.microsoft.com
up
-1
monroe at peoplego dot com
21 years ago
INSTALLATION ON OPENBSD 3.1 VIA PORTS COLLECTION
Would have succeed but no mysql support.
I commented out the FLAVORS+= dbase filepro mysql mysql_bundled postgresql iodbc in the /usr/ports/www/php4/Makefile and in the configure options added 
--with-mysql=/usr/local   and it worked.

Good Luck
up
-2
joerg at fenin dot de
16 years ago
To limit HTTP Request Methods on the Apache server running PHP you should use mod_rewrite or mod_security instead of LimitExcept, to give you more control over the handling of such http errors.  Can go in .htaccess file or httpd.conf

# mod_rewrite
<IfModule mod_rewrite.c>
  RewriteEngine On
  RewriteCond %{REQUEST_METHOD} !^(GET|HEAD|POST)$
  RewriteRule .* - [F,L]
</IfModule>

# mod_security
<IfModule mod_security.c>
  SecFilterSelective REQUEST_METHOD "!^(GET|HEAD|POST)$" "deny,log,status:403"
</IfModule>

You can use the php request method scanner at askapache to see exactly how your server deals with various request methods, and check that your server is configured properly.. 

http://www.askapache.com/online-tools/request-method-scanner/
up
-4
barry dot fagin at usafa dot af dot mil
19 years ago
Fixing 404 (file not found) errors with PHP 5.0.3 and IIS 6.0

IIS 6.0 is installed with security settings that don't permit dynamic content.  This means that even if all the hints in the FAQ are paid attention to (.ini modified correctly, security and permissions correct for IUSR_xxx user, etc), you still get 404 errors for all php files. 

To fix this:  IIS Manager -> expand local computer -> Web Services Extensions -> Add web service or extension -> .php, browse to c:\php\php-cgi.exe or wherever you had the php executable installed. That plus setting the doc_root in the .ini file solved the problem.

--BF
To Top