Встановлення

Цей розділ містить загальні питання по встановленню PHP. PHP доступна майже для будь-яких Операційних Систем (можливо лише за виключенням MacOS перед OSX), та для більшості веб-серверів.

Щоб встановити PHP, пройдіть кроки описані в розділі Встановлення та Налаштування.

  1. Чому я не повинен використовувати Apache2 з потоковим MPM на робочих серверах?
  2. Unix/Windows: Де повинен знаходитись файл php.ini?
  3. Unix: Я встановив PHP, але кожен раз завантажуючи документ, я отримую повідомлення 'Document Contains No Data'! (Документ не містить даних) Чому так відбувається?
  4. Unix: Я встановив PHP використовуючи RPMS, але Apache не обробляє сторінки PHP! Чому так відбувається?
  5. Unix: Я залатав Apache за допомогою розширення FrontPage, але раптово PHP перестав працювати. Виходить, що PHP з розширенням FrontPage для Apache несумісні?
  6. Unix/Windows: Я встановив PHP, але коли намагаюсь викликати PHP-скрипти через браузер, то отримую пустий екран.
  7. Unix/Windows: Я встановив PHP, але коли намагаюсь викликати PHP-скрипт через веб-браузер, то отримую помилку сервера 500.
  8. Деякі Операційні Системи: Я встановив PHP без помилок, але коли намагаюсь запустити Apache, то отримую помилки "undefined symbol" (невизначений символ): [mybox:user /src/php5] root# apachectl configtest apachectl: /usr/local/apache/bin/httpd Undefined symbols: _compress _uncompress
  9. Windows: Я встановив 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. Windows: Я дотримувався всіх інструкцій, але все ще не можу запустити PHP та IIS, для їх сумісної роботи!
  11. При запуску PHP як CGI на IIS, PWS, OmniHTTPD або Xitami, я отримую наступну помилку: Security Alert! PHP CGI cannot be accessed directly.
  12. Як я можу переконатись, що мій файл php.ini знаходиться та читається? Схоже, що коли я його змінюю, мої зміни не впроваджуються.
  13. Як я можу додати директорію PHP до PATH на Windows?
  14. Як зробити доступним файл php.ini для PHP на Windows?
  15. Чи можна використовувати Apache Content Negotiation (опцію MultiViews) разом з PHP?
  16. Чи можна зробити обмеження з боку PHP, щоб обробляти тільки запити від методів GET та POST?
Чому я не повинен використовувати Apache2 з потоковим MPM на робочих серверах?

PHP виконує функції своєрідного клея. Цей клей використовується щоб створювати класні веб-застосунки, з'єднуючи дюжину сторонніх бібліотек разом та створюючи враження єдиного злагодженого цілого, при використанні інтуїтивно-зрозумілого та легкого для навчання інтерфейсу мови. Гнучкість та потужність PHP спирається на стабільність та надійність базової платформи. Потрібно щоб працювала ОС, працював веб-сервер, та працювали сторонні бібліотеки з'єднані разом. Якщо будь-хто з них зупинеться, то для PHP потрібен спосіб для виявлення цієї проблеми та швидкого виправлення. Коли ви робите звичайні умови розробки більш складними, при цьому не маючи повністю розділених виконавчих потоків, повністю розділених сегментів пам'яті, та міцьного майданчику для експерементальних розробок, то це означає, що у вашої PHP-системі з'являються слабкі місця.

Якщо ви хочете використовувати потоковий MPM, спробуйте сконфігурувати FastCGI, під яким можна виділяти окремий простір пам'яті для PHP.

Unix/Windows: Де повинен знаходитись файл php.ini?

Початково в Unix-системах він повинен бути в /usr/local/lib, що визначається як <шлях-встановлення>/lib. Більшість користувачів змінює його під час компіляції через флаг --with-config-file-path. Тобто, наприклад, це можна зробити так:

--with-config-file-path=/etc
Після чого потрібно скопіювати вміст файла php.ini-development з дистрибутива до /etc/php.ini та змінити його під себе.

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

У Windows початково, шлях для php.ini, веде до директорії Windows. Якщо ви використовуєте веб-сервер Apache, файл php.ini спочатку шукається в директорії, де встановлено Apache, наприклад в c:\program files\apache group\apache. В такому разі, ви можете мати кілька різних файлів php.ini для різних версій Apache на одній і тій самій машині.

Прочитайте також інформацію про Файл конфігурації.

Unix: Я встановив PHP, але кожен раз завантажуючи документ, я отримую повідомлення 'Document Contains No Data'! (Документ не містить даних) Чому так відбувається?

Це ймовірно означає, що в PHP виникли деякі проблеми, та її ядро впало. Продивіться журнали помилок сервера, та спробуйте відтворити проблему створивши невеличкий тест. Якщо ви знаєте як використовувати 'gdb', це може бути дуже корисним, бо ви можете надати зворотній слід (backtrace) разом з вашим звітом про неполадку, щоб допомогти розробникам точно визначити проблему. Якщо ви використовуєте PHP як модуль Apache, спробуйте щось схоже на це:

  • Зупиніть процес httpd, та виконайте наступну команду:

  • gdb httpd

  • Зупиніть процес httpd, та виконайте наступну команду:

  • > run -X -f /шлях/до/httpd.conf

  • Потім через браузер викличте URL, що викликає вашу проблему, та виконайте наступну команду:

  • > run -X -f /шлях/до/httpd.conf

  • Якщо ядро впаде, gdb повинен проінформувати вас про це

  • виконайте команду: bt

  • Вам потрібно включити отриманий зворотній слід (backtrace) у звіт про неполадку на сайті » http://bugs.php.net/

Якщо ваш скрипт використовує функцію регулярного виразу (preg_match() та подібні), потрібно переконатись, що ви зібрали PHP та Apache з одним і тим же пакетом регулярних виразів. Це повинно відбуватись автоматично з PHP та Apache 1.3.x

Unix: Я встановив PHP використовуючи RPMS, але Apache не обробляє сторінки PHP! Чому так відбувається?

Якщо припустити, що ви встановили Apache та PHP з пакетів RPM, то в такому разі, вам потрібно розкоментувати або додати кілька або всі рядки у ваш файл httpd.conf:

# Додаткові модулі
AddModule mod_php.c
AddModule mod_perl.c

# Додаткові модулі
LoadModule php_module         modules/mod_php.so
LoadModule php5_module        modules/libphp5.so
LoadModule perl_module        modules/libperl.so
Та додати:
AddType application/x-httpd-php .php
... до глобальних властивостей, або до властивостей VirtualDomain, куди ви хочете додати підтримку PHP.

Unix: Я залатав Apache за допомогою розширення FrontPage, але раптово PHP перестав працювати. Виходить, що PHP з розширенням FrontPage для Apache несумісні?

Ні, PHP добре працює з розширенням FrontPage. Проблема в тому, що латка FrontPage змінює деякі структури Apache, на які PHP покладається. Перекомпіляція PHP (використовуючи 'make clean ; make') після встановлення латки FrontPage, повинна вирішити цю проблему.

Unix/Windows: Я встановив PHP, але коли намагаюсь викликати PHP-скрипти через браузер, то отримую пустий екран.

Прогляньте сирцевий код (view source) у веб-браузері, і ви мабуть побачите сирцевий код PHP-скрипта. Це означає, що веб-сервер не відправляє скрипт до PHP-інтерпритатора. Тобто є якісь помилки в конфігурації веб-сервера, то ж двічі перевірте цю конфігурацію, дотримуючись інструкцій встановлення PHP.

Unix/Windows: Я встановив PHP, але коли намагаюсь викликати PHP-скрипт через веб-браузер, то отримую помилку сервера 500.

Щось помилкове стається, коли веб-сервер намагається запустити PHP. Щоб побачити зрозумілі повідомлення помилок, з командного рядка, змініть поточну директорію на ту, де знаходиться виконавчий файл PHP (у Windows це php.exe) та запустіть php -i. Якщо PHP матиме будь-яку проблему, то вона покаже відповідне повідомлення помилки, яке дасть вам уявлення "що робити далі". Якщо ж вам видається повен екран HTML-коду (що є виводом функції phpinfo()), то PHP працює справно, і проблема можливо стосується конфігурації веб-сервера, яку вам потрібно двічі перевірити.

Деякі Операційні Системи: Я встановив PHP без помилок, але коли намагаюсь запустити Apache, то отримую помилки "undefined symbol" (невизначений символ):
[mybox:user /src/php5] root# apachectl configtest
 apachectl: /usr/local/apache/bin/httpd Undefined symbols:
  _compress
  _uncompress

Це повідомлення насправді стосується не PHP, а клієнтської бібліотеки MySQL. В деяких випадках потрібно --with-zlib , а в деяких - ні. Дана проблема згадана в ЧАПі MySQL.

Windows: Я встановив 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 (у Windows це php.exe) та запустіть команду php -i. Якщо PHP матиме будь-яку проблему, то вона покаже відповідне повідомлення помилки, яке дасть вам уявлення "що робити далі". Якщо ж вам видається повен екран HTML-коду (що є виводом функції phpinfo()), то PHP працює справно.

Як тільки PHP справно запрацює, з командного рядка, спробуйте знову доступитись до скрипта через браузер. Якщо проблема ще залишається, то причина може бути однією з наступних:

  • Анонімний інтернет-користувач ISUR_<тут-ім'я-машини>, через відсутність прав, не може отримати доступ до PHP-скриптів, php.exe, php5ts.dll, php.ini або до будь-якого PHP-розширення, яке ви намагаєтесь завантажити.
  • Файла зі скриптом не існує (або, можливо, він не там, де ви його уявляєте, по відношенню до кореневої директорії вашого веб-сервера). Зауважте, що в IIS ви можете попастись на це повідомлення, якщо поставите галочку 'check file exists' (перевіряти наявність файла) під час налаштування співставлення скриптів (їх мапінгу) в Менеджері Internet Services. Насправді, якщо файлу зі скриптом не існує, то веб-сервер повертатиме 404 помилку. Також існує додаткова перевага в тому, що IIS буде виконувати будь-яку автентифікацію, яка базується на NTLanMan-дозволах для файлів зі скриптами.
Windows: Я дотримувався всіх інструкцій, але все ще не можу запустити PHP та IIS, для їх сумісної роботи!

Переконайтесь, що всі користувачі, кому потрібно запускати PHP-скрипти, мають права на запуск php.exe! IIS використовує анонімного користувача, який додається під час встановлення IIS. Цьому користувачу потрібні права на запуск php.exe. Права на запуск php.exe також потрібні для будь-якого авторизованого користувача. А IIS4, потрібно повідомити, що PHP є скриптовою системою. Також, вам буде цікаво прочитати цей пункт ЧАПу.

При запуску PHP як CGI на IIS, PWS, OmniHTTPD або Xitami, я отримую наступну помилку: Security Alert! PHP CGI cannot be accessed directly.

Вам потрібно встановити для директиви cgi.force_redirect значення 0 (початково встановлено 1), а також переконайтесь, цю що директиву не закоментовано (через символ крапки-з-комою ;). Як і всі директиви, вона також знаходиться у файлі php.ini

Оскільки початково встановлено 1, то дуже важливо, щоб ви переконались на 100%, що буде читатись коректний файл php.ini. Читайте детальніше в цьому пункті ЧАПу.

Як я можу переконатись, що мій файл 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 на Windows?

На Windows NT+ та Windows Server 2000+:

  • Перейдіть в Панель Керування та клікніть на ярлику Система (Старт -> Налаштування -> Панель Керування -> Система, або просто Старт -> Панель Керування -> Система на Windows XP/2003+)

  • Перейдіть на закладку Додатково

  • Клікніть кнопку 'Змінні оточення'

  • Огляньте блок 'Системні Змінні'

  • Знайдіть запис Path (можливо потрібно прокрутити список, щоб знайти цю змінну)

  • Подвійним кліком відкрийте знайдений запис Path

  • Допишіть до існуючого запису символ ';' (якщо його немає в кінці) і далі впишіть шлях до вашої директорії PHP (напр. ;C:\php)

  • Натискайте OK

У Windows 98/Me вам потрібно змінити файл autoexec.bat:

  • Відкрийте Блокнот (Старт -> Виконати та введіть notepad)

  • Відкрийте файл C:\autoexec.bat

  • Знайдіть рядок із PATH=C:\WINDOWS;C:\WINDOWS\COMMAND;..... та допишіть: ;C:\php в кінець рядка

  • Збережіть файл та перезапустіть ком'ютер

Зауваження: Не забудьте перезавантажитись після того, як пройдете зазначені вище кроки, щоб зміни для PATH були задіяні.

В даному PHP посібнику ще залишились рекомендації копіювання файлів в системну директорію Windows. Такі рекомендації писались тільки через те, що ця директорія (C:\Windows, C:\WINNT, і т.д.) початково є в системній змінній PATH. На даний момент, рекомендація копіювання файлів в системну директорію Windows давно вже є застарілою та може спричиняти проблеми.

Як зробити доступним файл php.ini для PHP на Windows?

Є кілька варіантів це зробити. Якщо ви використовуєте Apache, прочитайте призначені для нього інструкції встановлення (Apache 1, Apache 2), в іншому випадку - ви повинні встановити змінну оточення PHPRC:

На Windows NT, 2000, XP та 2003:

  • Перейдіть в Панель Керування та клікніть ярлик Система (Старт -> Налаштування -> Панель Керування -> Система, або просто Старт -> Панель Керування -> Система на Windows XP/2003)

  • Перейдіть на закладку Додатково

  • Клікніть кнопку 'Змінні Оточення'

  • Знайдіть область 'Системні змінні'

  • Клікніть 'Нова' та введіть 'PHPRC' як назву змінної, а шлях до директорії, де розміщено php.ini як значення цієї змінної (наприклад C:\php)

  • Натискайте OK та перезавантажуйте ком'ютер

На Windows 98/Me вам потрібно змінити файл autoexec.bat:

  • Відкрийте Notepad (Старт -> Виконати та введіть notepad)

  • Відкрийте файл C:\autoexec.bat

  • Додайте новий рядок в кінець файла та допишіть в нього: set PHPRC=C:\php (тільки замініть C:\php на шлях до директорії, де розміщено php.ini). Пам'ятайте, що шлях до директорії не може містити пробіли. Наприклад, якщо ви встановили PHP в C:\Program Files\PHP, вам потрібно вписувати замість нього шлях C:\PROGRA~1\PHP.

  • Збережіть файл та перезавантажте комп'ютер

Чи можна використовувати Apache Content Negotiation (опцію MultiViews) разом з PHP?

Якщо посилатись на файли PHP разом з розширенням, то все працює справно. Цей пункт ЧАПу призначений тільки для випадку, коли посилання на файли PHP не містять розширення, та ви хочете використовувати Content Negotiation для вибору файлів PHP з URL без розширень. В цьому випадку, замініть рядок AddType application/x-httpd-php .php на такий:

AddHandler php5-script php
AddType text/html php
Це рішення не працює для Apache 1, оскільки модуль PHP не ловить php-script.

Чи можна зробити обмеження з боку PHP, щоб обробляти тільки запити від методів GET та POST?

Ні, навпаки - можна обробляти запити, що відправляються будь-яким методом, наприклад, CONNECT. Правильну відповідь статуса можна відправляти через функцію header(). Якщо ж вам потрібно, щоб оброблялись тільки методи GET та POST, цього можна добитись завдяки наступній конфігурації Apache:

<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
16 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