Php4Hs: Articles
Setting up PHP with OmniHTTPd
By Dan Delaney, daniel@delaney.net, July 2002
For those developers who want to develop PHP sites on a Windows
setup, messing around with Personal Web Server or trying to get IIS
working properly with PHP can prove too much hassle, and that's not even
considering Apache or iPlanet. As a simple development environment, and
as the host for low traffic sites, I recommend the use of OmniHTTPd.
OmniHTTPd has been around for a while, and I first used it as the
basis for CGI development on Win98 & NT4 back in 1999. For more
information on OmniHTTPd visit the
Omnicron website
- at the time of writing the latest version is 2.09
This is a step-by-step guide to installing OmniHTTPd, the latest PHP,
and testing the PHP setup.
- Download the latest Windows binary from the
PHP website.
For the purposes of this setup, get the ZIP package, not the PHP
installer. If you haven't already got one, you might require a
program to extract ZIP files, such as Winzip
- Download the latest OmniHTTPd build from the
Omnicron website.
- Install OmniHTTPd
- Start the OmniHTTPd installation
- When the installation of OmniHTTPd starts press 'Next', 'Yes'
and 'Next' to accept the License Agreements.
- To change the destination folder, click Browse. For the purposes
of this guide, I will assume OmniHTTPd is installed at the
default destination (c:\httpd)
- Choose 'Typical' installation type. (For those who may wish
to change some options, choose 'Custom' then click 'Next' but
do not deselect 'PHP Support' at the next screen). Click 'Next'.
- If you're installing on Windows NT / 2000 / XP, you will be asked
if you want to install OmniHTTPd as a service. I would
recommend declining this, but it's up to you. It makes no
particular difference in performance.
- Choose 'Next' on the program folder selection screen,
- The program will now install
- At the prompt 'Do you want OmniHTTPd to run automatically at
startup', again this decision is up to you.
- By default, the next screen will have the options 'Yes, I want
to read the README file.' and 'Yes I want to launch the server
and browse my new site.' are selected. Deselect the 2nd option
(launch server) as we do not want the server to run. If you
don't want to read the README file, go ahead and deselect that
option as well.
- Click 'Finish'
- Installing PHP ( so that OmniHTTPd will pick it up automatically )
- Open the ZIP package
- Ensure that 'keep folder names' is selected in your Open the
OmniHTTPd installation folder in My Computer or Windows
Explorer: c:\httpd
- Open My Computer or Windows Explorer and go to c:\httpd
- Rename the folder php to php-orig (or remove it
if you don't want to keep a backup)
- Rename the new php folder (eg: php-4.2.1-Win32) to php
- Using notepad, open the file c:\httpd\php\php.ini-dist
- Press F3 and type - cgi.force_redirect = 1 - into the
search box. Change the selected line:
; cgi.force_redirect = 1
to read
cgi.force_redirect = 0
- Using File > Save As, save the file as php.ini in your
Windows directory ( usually c:\WINDOWS or
c:\WINNT ). You may be prompted if you want to
overwrite the existing file.. select 'Yes'.
- Checking your PHP installation
- Open Notepad, or some other text editor
- Type in the following PHP code:
<?php
phpInfo();
?>
- Save the file as c:\httpd\htdocs\phpTest.php
- Start OmniHTTPd ( Click on Start > Programs > OmniHTTPd
Professional 2.0 > OmniHTTPd )
- Open a web browser and type in the following URL: http://127.0.0.1/phpTest.php
or http://localhost/phpTest.php
- If all is well, you should get a long list detailing your
PHP configuration with the build number at the top.
Configuration of OmniHTTPd to point at different directories for your
web content, uses a very intuitive Administration interface. To use this
interface, either right-click on the omnihttpd icon in your system tray
(if you didn't install OmniHTTPd as a service) or by selecting the
'OmniHTTPd Administration' item from the OmniHTTPd Professional 2.0
folder in your Programs menu.
If you have any questions at any stage of this guide, or you find
an error or omission, feel free to email
them to me